From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Tom Breton <tehom@panix.com>
Cc: 5728@debbugs.gnu.org
Subject: bug#5728: Byte compile doesn't work right on macro
Date: Thu, 08 Apr 2010 16:02:55 -0400 [thread overview]
Message-ID: <jwvk4sindev.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <E1NrMTf-0000f5-TZ@localhost> (Tom Breton's message of "Mon, 15 Mar 2010 22:25:51 -0400")
> When I byte-compile certain code, the results are different than when
> it's not byte-compiled. It seems to wrongly merge lists. The one
> unusual thing I was doing with the code is using a macro to generate a
> call to a ctor (as generated by defstruct)
You're victim of a form of "name capture".
E.g. if you rename `a' to `b' in BUG3, the bug disappears.
And if you macroexpand by hand the call to BUG:make-form the bug is
still there.
More to the point, the bug is in the compiler-macro for
BUG:make-structure:
ELISP> (compiler-macroexpand '(BUG:make-structure :edits (cons (car a) (BUG:structure->edits cand)) :a nil))
(block BUG:make-structure
(vector 'cl-struct-BUG:structure
(cons (car nil) (BUG:structure->edits cand))
nil))
ELISP> (defsubst* toto (a1 a2) (+ a1 a2))
toto
ELISP> (compiler-macroexpand '(toto a2 nil))
(block toto (+ nil nil))
ELISP>
The problem is that cl-defsubst-expand does the substitution "a1 -> a2
and a2 -> nil" one after the other rather than simultaneously.
I've just installed a fix for it in the emacs-23 branch.
Stefan
prev parent reply other threads:[~2010-04-08 20:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 2:25 bug#5728: Byte compile doesn't work right on macro Tom Breton
2010-04-08 20:02 ` Stefan Monnier [this message]
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=jwvk4sindev.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=5728@debbugs.gnu.org \
--cc=tehom@panix.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).