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

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

bug#46834: 28.0.50; byte-compiling the standard counter closure fails


From: Pip Cet
Subject: bug#46834: 28.0.50; byte-compiling the standard counter closure fails
Date: Mon, 1 Mar 2021 15:01:51 +0000

On Mon, Mar 1, 2021 at 2:23 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> > diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
> > index a2fe37a1ee586..7d00b453caf1c 100644
> > --- a/lisp/emacs-lisp/bytecomp.el
> > +++ b/lisp/emacs-lisp/bytecomp.el
> > @@ -2785,16 +2785,12 @@ byte-compile--reify-function
> >      (dolist (binding env)
> >        (cond
> >         ((consp binding)
> > -        ;; We check shadowing by the args, so that the `let' can be moved
> > -        ;; within the lambda, which can then be unfolded.  FIXME: Some of 
> > those
> > -        ;; bindings might be unused in `body'.
> > -        (unless (memq (car binding) args) ;Shadowed.
> > -          (push `(,(car binding) ',(cdr binding)) renv)))
> > +        (push `(,(car binding) ',(cdr binding)) renv))
> >         ((eq binding t))
> >         (t (push `(defvar ,binding) body))))
> >      (if (null renv)
> >          `(lambda ,args ,@preamble ,@body)
> > -      `(lambda ,args ,@preamble (let ,(nreverse renv) ,@body)))))
> > +      `(let ,renv (lambda ,args ,@preamble ,@body)))))
>
> This looks good, thanks, but it changes the nature of the output of
> `byte-compile` from a function value to an expression whose evaluation
> returns a function value.  So I think we should tweak `byte-compile` so
> it calls `eval` on the result in this particular case.

Thanks! That's a good catch :-)

Is this what you meant?

Pip

Attachment: 0001-Compile-closures-that-modify-their-bound-vars-correc.patch
Description: Text Data


reply via email to

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