Subject: bug#57397: cl-letf blindly macroexpands places

From: Michael Heerdegen <[email-masked]>
Date: Wed, 28 Sep 2022 17:44:14 +0200

Stefan Monnier <[email-masked]> writes:

> diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
> index 983dfe2ec59..8e34fdf3640 100644
> --- a/doc/lispref/functions.texi
> +++ b/doc/lispref/functions.texi
> @@ -2476,11 +2476,11 @@ Declare Form
>  expander will call @var{expander} with that form as well as with
>  @var{args}@dots{}, and @var{expander} can either return a new expression to use
>  instead of the function call, or it can return just the form unchanged,
> -to indicate that the function call should be left alone.  @var{expander} can
> -be a symbol, or it can be a form @code{(lambda (@var{arg}) @var{body})} in
> -which case @var{arg} will hold the original function call expression, and the
> -(unevaluated) arguments to the function can be accessed using the function's
> -formal arguments.
> +to indicate that the function call should be left alone.
> +
> +To avoid syntactic redundancy, when @var{expander} is of the form
> +@code{(lambda (@var{arg}) @var{body})} the function's formal arguments
> +are automatically added to the lambda's list of arguments.

Yes, that would have helped a lot.  A definitive improvement.

But could we maybe describe that simpler like "when expander is a lambda
form [...]"?  - Because AFAIU these arguments are added to _any_
argument list - with other words, implicitly hint that it's an error to
specify function arguments in the lambda arglist explicitly, or to
provide an empty arglist.

Michael.