Subject: Re: bug#65344: 28.2; Unable to Edebug cl-flet form which uses argument destructuring

From: Brandon Irizarry <[email-masked]>
Date: Thu, 17 Aug 2023 11:42:06 -0400

Destructured lambda-lists appear to be an Elisp extension to Common Lisp's
argument notation,
and the Emacs docs do mention them (though not in the Elisp manual; rather,
it's in the CL-Lib manual).
They even mention your point about such a lambda-list not being valid
Common Lisp.

>From the CL-Lib manual, 4.3.2 (Function Bindings):

     Functions defined by ‘cl-flet’ may use the full Common Lisp
     argument notation supported by ‘cl-defun’; also, the function body
     is enclosed in an implicit block as if by ‘cl-defun’.  *Note
     Program Structure::.

Following the reference to Chapter 2, and heading into 2.1 (Argument
Lists):

   Argument lists support “destructuring”.  In Common Lisp,
destructuring is only allowed with ‘defmacro’; this package allows it
with ‘cl-defun’ and other argument lists as well.

That is, while 'defun' doesn't support this, 'cl-defun' (and, by extension,
'cl-flet') does.

- Brandon

On Thu, Aug 17, 2023 at 1:29 AM Gerd Möllmann <[email-masked]>
wrote:

> > (cl-flet ((fn ((min max))
> >      (message "%d %d" min max)))
> >   (fn '(2 3)))
> >
> > The cl-flet form evaluates fine (e.g. with C-x C-e or C-M-x), which
> > leads me to conclude that this construct is legal.
>
> I think this lambda-list is invalid.  It certainly is invalid in CL, and
> I can't find any extension mentioned in the Emacs docs.
>
> Why this doesn't signal an error at evaluation time, I don't know.  If
> you try this with defun, you get an error.
>