Hm, I seem to have expressed myself a bit poorly,
so let me clear it up:
> Obviously, named functions are used all over the place with
> lexical-binding, so they do work in many circumstances.
I know that and what I wrote was not meant to contradict it, because
you write about general, I wrote about inside lexical-binding enabled files
where lexical-let and let should be the same (since lexical binding is
> `lexical-let' inside a lexical binding enabled file produces tons of
> "bad lexing"
> errors when used with named functions
To clarify, I wrote nothing about `lexical-let' in general, I wrote that
inside a lexical binding enabled file (meaning with the
"lexical-binding: t" header)
together with a named function would produce errors.
You can try it out for yourself with the code I send in the same mail
you refer to:
Switch to an empty buffer, paste it and then do `M-x eval-buffer' `M-x bar'
and you'll get a [bad-lexical-ref] error.
Remove the header ( the ;;; foo.el line), do `M-x eval-buffer' `M-x bar'
again and you won't get an error, but a message with the selected window.
If you use a lambda inside the defun of bar instead of foo, it will work
with and without
lexical-binding enabled. And this difference is what I simply don't
Now, since I had no idea why the function `lexical-let' would behave
(if it didn't there should be either an error with AND without the
both should work fine), could not find any clues in info/manual/docstring
and more, why it doesn't work, I wrote that.