[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14422: 24.3; Eager Macro Expansion
From: |
Stefan Monnier |
Subject: |
bug#14422: 24.3; Eager Macro Expansion |
Date: |
Thu, 30 May 2013 15:00:50 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> Here's the revised test case that compiles cleanly and still has the
> same problem:
> (defvar eme-ll nil)
> (defmacro one (p)
> `(progn (push ',p eme-ll)))
> (defmacro two (p)
> (let (pp)
> (setq pp (append eme-ll p))
> `(progn (push ',pp eme-ll))))
> (provide 'eme)
> (require 'eme)
> (require 'ert)
> (ert-deftest surprise ()
> (should
> (equal '((one . two) one)
> (progn
> (one one)
> (two two)
> eme-ll))))
I see the test fails, but that's just because the test is wrong.
Try to create a new file foo.el:
(require 'eme)
(message "Result = %s"
(progn
(one one)
(two two)
eme-ll))
Then byte-compile it. Then do
emacs23 --batch -Q -l ~/tmp/foo.el
and
emacs23 --batch -Q -l ~/tmp/foo.elc
You'll see that your code behaves differently when byte-compiled.
Stefan
Analysis:
(one one)
will add `one' to eme-ll at run-time.
(two two)
reads the macroexpansion-time (e.g. compilation-time, load-time, or
run-time) value of eme-ll and adds it to eme-ll at run-time.
eme-ll
returns the run-time value of eme-ll.