bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31792: 27.0.50; Regression in #'labels, recent versions


From: Stefan Monnier
Subject: bug#31792: 27.0.50; Regression in #'labels, recent versions
Date: Wed, 13 Jun 2018 23:32:02 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>  (defmacro cl-flet (bindings &rest body)
>    "Make local function definitions.
> -Like `cl-labels' but the definitions are not recursive.
> +Bind the function cells of symbols within FORM.

I think this is wrong: it makes it sound like it does `fset`, which
is what CL's `flet` did, but not what `cl-flet` does.
If you look at the implementation, you'll see that it doesn't touch any
"function cell".

> +The bindings only take effect within FORM, not BODY, so you can't
> +write recursive function definitions.  Use `cl-labels' for that.
> +See info node `(cl) Function Bindings' for details.

This is good, thanks.

>  (defmacro cl-labels (bindings &rest body)
> -  "Make temporary function bindings.
> -The bindings can be recursive and the scoping is lexical, but capturing them
> -in closures will only work if `lexical-binding' is in use.
> +    "Make local function definitions.
> +Bind the function cells of symbols within FORM.

Same here about "function cells".

> diff --git a/lisp/emacs-lisp/cl.el b/lisp/emacs-lisp/cl.el
> index d53c8e0bbc..f6643158d2 100644
> --- a/lisp/emacs-lisp/cl.el
> +++ b/lisp/emacs-lisp/cl.el
> @@ -466,9 +466,12 @@ labels
>       (push var sets)
>       (push (cons (car binding)
>                      `(lambda (&rest cl-labels-args)
> -                       (cl-list* 'funcall ',var
> -                                 cl-labels-args)))
> +                       (if (eq (car cl-labels-args) cl--labels-magic)
> +                           (list cl--labels-magic ',var)
> +                         (cl-list* 'funcall ',var cl-labels-args))))
>                newenv)))
> +    ;; `lexical-let' adds `cl--function-convert' (which calls
> +    ;; `cl--labels-convert') as a macroexpander for `function'.
>      (macroexpand-all `(lexical-let ,vars (setq ,@sets) ,@body) newenv)))

Good, thanks.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]