501798 (1) [Avatar] Offline
#1
It is said that runtime type checks were added, via pattern matching, that the first arg is an instance of the TodoList struct.

def add_entry(todo_list, entry) do
end

def entries(todo_list, date) do
end


Shouldn't that be?

def add_entry(%TodoList{} = todo_list, entry) do
end

def entries(%TodoList{} = todo_list, date) do
end
sjuric (106) [Avatar] Offline
#2
I've decided to remove the runtime type check in the 2nd edition. Therefore, the code is in fact correct, but the sentence should be removed. This will be done in the next MEAP release. Thanks for reporting!
409563 (4) [Avatar] Offline
#3
sjuric wrote:I've decided to remove the runtime type check in the 2nd edition. Therefore, the code is in fact correct, but the sentence should be removed. This will be done in the next MEAP release. Thanks for reporting!


Curious about why it should be removed.