Re: What is the difference between ‘cl-labels’ and ‘named-let’?

Michael Heerdegen via Users list for the GNU Emacs text editor <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
tpeplt <[email protected]> writes:

> The Emacs Lisp reference manual does not describe the
> difference between the new-ish (since Emacs 28) ‘named-let’
> and ‘cl-labels’ (other than the syntax, which allows
> ‘cl-labels’ to define many recursive local functions, while
> ‘named-let’ can only define one function per call).  Are
> these two different in some significant way?

I think Stefan will probably be the one to answer this in depth, so I'll
just skip this part of your question.


> Also, the Emacs Lisp reference manual describes ‘named-let’
> as a special form (like ‘if’), while its docstring describes
> it as a macro.  Is this an error in the reference manual?
>
>   (info "(elisp) Local Variables")

A very good remark (I think it is).

I want to add another one about the docstring:

| (named-let NAME BINDINGS &rest BODY)
| 
| Looping construct taken from Scheme.
| Like `let', bind variables in BINDINGS and then evaluate BODY,
| but with the twist that BODY can evaluate itself recursively by
| calling NAME,

Is it clear here that "calling" means "calling like a named function" - as
opposed to "funcall NAME"?  I had to look it up...


Michael.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.