From: Lars Ingebrigtsen <larsi@gnus.org>
To: Pip Cet <pipcet@gmail.com>
Cc: 46834@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#46834: 28.0.50; byte-compiling the standard counter closure fails
Date: Mon, 01 Mar 2021 14:16:39 +0100 [thread overview]
Message-ID: <8735xf8154.fsf@gnus.org> (raw)
In-Reply-To: <CAOqdjBeBwgTtTrrecExPb-toa54t6Vm6USO4F0fwWWYN62UYVw@mail.gmail.com> (Pip Cet's message of "Sun, 28 Feb 2021 19:57:59 +0000")
Pip Cet <pipcet@gmail.com> writes:
>> Steps to reproduce from emacs -Q:
>> Evaluate the following in a lexically-bound Emacs Lisp buffer:
>>
>> (byte-compile (let ((l 0)) (lambda () (cl-incf l))))
>>
>> Expected result:
>>
>> A byte code object which will increment its return value by one every
>> time it is called.
>>
>> Actual result:
>>
>> A byte code object which always returns 1.
Huh, that's such a standard example of using closures that it's
surprising that we haven't tripped on this before... but I guess we
don't really write code like that much in Emacs. (I can confirm that
the test case doesn't work in Emacs 28.)
> Patch attached. I've looked through the generated bytecode for all of
> lisp/ and there appear to be no significant differences.
I've added Stefan M to the CCs; perhaps he has some comments.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2021-03-01 13:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-28 15:04 bug#46834: 28.0.50; byte-compiling the standard counter closure fails Pip Cet
2021-02-28 19:57 ` Pip Cet
2021-02-28 20:34 ` Pip Cet
2021-03-01 14:23 ` Stefan Monnier
2021-03-01 15:01 ` Pip Cet
2021-03-01 16:02 ` Stefan Monnier
2021-03-02 7:00 ` Lars Ingebrigtsen
2021-03-02 7:31 ` Pip Cet
2021-03-02 7:34 ` Lars Ingebrigtsen
2021-03-02 7:36 ` Pip Cet
2021-03-02 13:16 ` Eli Zaretskii
2021-03-02 13:19 ` Pip Cet
2021-03-02 13:48 ` Eli Zaretskii
2021-03-01 13:16 ` Lars Ingebrigtsen [this message]
2021-03-01 14:34 ` Stefan Monnier
2021-03-01 15:16 ` Pip Cet
2021-03-01 16:15 ` Stefan Monnier
2021-03-01 16:41 ` Pip Cet
2021-03-01 17:01 ` Stefan Monnier
2021-03-01 17:13 ` Pip Cet
2021-03-01 16:31 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8735xf8154.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=46834@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=pipcet@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).