Will be useful to write/build literal closures?
Should it be a good practice? any example?
Why the closure is not a real type instead of cons?
All three questions are answered with the following quote of the elisp manual:
However, the fact that the internal structure of a closure is exposed to
the rest of the Lisp world is ...
There's a few pitfalls here:
Using eval with lexical-binding will fail unless you pass it an alist environment argument holding the bindings in question (see F1 f eval)
Looking up symbol slots only behaves correctly with dynamic scoping, if you attempt it despite this, you'll get the global value (see F1 f symbol-value)
FWIW, this is what I'd call the ...
Don't quote callback here:
(funcall 'callback data)
Quoted, you've said to call the function named "callback" (i.e. using the function slot of the callback symbol).
What you want to do is call the function in the value of the callback argument:
(funcall callback data)
I was experimenting with the reader macros and I think I figured it out. The problem is that I am trying to evaluate, the let values twice. Once when they are first bound and then again when we rebind them. This is not a problem for variables that are strings, because strings always evaluate to themselves. But lambdas evaluate to closures, and you can’t ...