GNU bug report logs - #14422
Apply eager-macroexpansion everywhere (eval-region, ...)

Previous Next

Package: emacs;

Reported by: Achim Gratz <Stromeko <at> nexgo.de>

Date: Sun, 19 May 2013 14:28:01 UTC

Severity: minor

Tags: moreinfo

Found in version 24.3

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 14422 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Achim Gratz <Stromeko <at> nexgo.de>
Cc: 14422 <at> debbugs.gnu.org
Subject: Re: bug#14422: 24.3; Eager Macro Expansion
Date: Thu, 30 May 2013 15:00:50 -0400
> 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.




This bug report was last modified 4 years and 278 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.