On Jul 20, 2009, at 04:12, Daniel Kraft wrote:
No, I don't think there is. `let' can't operate on function slots.
Not in the main emacs lisp implementation. However, cl-macs.el
provides an "flet" macro that does work on function slots; it uses
the "letf" macro which expands to include a use of unwind-protect
to do its dirty work.
But that's not part of the real "elisp semantics", and so if we
don't want to include this as a genuine extension into Guile's
compiler, we don't have to use the fluids for function slots.
True.
With unwind-protect and friends one can, just like in emacs,
implement this functionality, even without a fluid implementation.
Yes... though it means the elisp implementation wouldn't be able to
cleanly support a multithreaded implementation that makes "flet"
possible to implement safely. If we want multiple threads, we
probably do want thread-safe flet, I would guess.
However, if you agree that this would be a useful feature (dynamic
scoping of functions) I can of course implement this as an extension
to elisp...? I agree that it might be of use sometimes, but am not
convinced it is really "necessary".
I haven't looked into what it's needed for in great detail, but it
does seem to get used in some places (gnus, mh-e, org, vc-rcs, ...).
I don't know if we'll get to multithreaded elisp (I kind of hope so)
or if we'll care about having a thread-safe flet (???), or thread-safe
versions of whatever other interesting things unwind-protect might be
getting used for.
Ken