[Top][All Lists]

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

bug#5728: Byte compile doesn't work right on macro

From: Stefan Monnier
Subject: bug#5728: Byte compile doesn't work right on macro
Date: Thu, 08 Apr 2010 16:02:55 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> 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

   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))
   ELISP> (defsubst* toto (a1 a2) (+ a1 a2))
   ELISP> (compiler-macroexpand '(toto a2 nil))
   (block toto (+ nil nil))

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.


reply via email to

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