GNU bug report logs - #31792
27.0.50; Regression in #'labels, recent versions

Previous Next

Package: emacs;

Reported by: Aidan Kehoe <kehoea <at> parhasard.net>

Date: Mon, 11 Jun 2018 23:12:01 UTC

Severity: normal

Tags: fixed, patch

Found in versions 27.0.50, 25.3

Fixed in version 26.2

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Aidan Kehoe <kehoea <at> parhasard.net>, 31792 <at> debbugs.gnu.org, Alan Mackenzie <acm <at> muc.de>
Subject: bug#31792: 27.0.50; Regression in #'labels, recent versions
Date: Wed, 13 Jun 2018 23:32:02 -0400
>  (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




This bug report was last modified 7 years and 30 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.