>The critical idea here is it applies to long-running functions, like a loop, a server, or other things. These, when handed function objects, will not reflect new behavior if you re-evaluate a single function.
Do you mind going into more details about what you mean here? In my experience, recursive loops will pick up a new function definition but non-recursive loops will only pick up the definition of a function upon entry.
Re:Why your REPL experience sucks
by suskeyhose on Wednesday November 30, 2022 @11:40PM
(#33812404)
The idea is such a long lasting loop would take the function object as an argument and call it repeatedly. Recursive or not (tho in clojure's case definitely not, no tail call optimization), doesn't matter as the lookup happened at the first function call.
CL: in a primitive way this can be done with generic functions. Use a generic function object. Redefined methods will be picked up without needing a new function object.
When using symbols, often it is not needed to look up symbol functions. Symbols can be called as functions. In code Lisp often assumes that functions are late bound (unless inlined), so a function call to a global function looks up the function from the symbol at runtime.
Re:Why your REPL experience sucks
by suskeyhose on Wednesday November 30, 2022 @11:43PM
(#33812432)
This is kinda my point tho, CL's symbols are the same as Clojure's vars for this purpose. And the comparison between generic functions and multimethods is obvious and correct here as well.
Late binding is irrelevant because all of this is about functions as arguments, not in funcall position.
The critical idea here is it applies to long-running functions, like a loop, a server, or other things. These, when handed function objects, will not reflect new behavior if you re-evaluate a single function.
The article solves for this by explaining to intermediate programmers that there is a difference between using function objects and using vars, something that Common Lisp programmers learn too by using #' to retrieve function objects and passing symbols and using symbol-function to look up the associated function as needed.