GNU bug report logs -
#40827
28.0.50; Macroexpansion at runtime
Previous Next
Full log
Message #8 received at 40827 <at> debbugs.gnu.org (full text, mbox):
Omar Antolín Camarena <omar <at> matem.unam.mx> writes:
> It seems that now, most of the time both the intepreter and the
> byte-compiler, whether using lexical binding or not, will expand macros
> at function definition time. This trick of combining an illegal (rx ...
> (eval ...) ...), with lexical binding, and with eval-defun is the only
> way I've found to trigger macro expansion at runtime.
[...]
> I discovered this during an interesting discussion on reddit, which you
> can read here:
>
> https://www.reddit.com/r/emacs/comments/g5bat3/weekly_tipstricketc_thread/fo362s8
[...]
> (info "(elisp) Repeated Expansion") says:
>
>> 14.5.5 How Many Times is the Macro Expanded?
>
>> Occasionally problems result from the fact that a macro call is
>> expanded each time it is evaluated in an interpreted function, but is
>> expanded only once (during compilation) for a compiled function. If
>> the macro definition has side effects, they will work differently
>> depending on how many times the macro is expanded.
Also further down:
[...] But in interpreted execution, the macro is expanded each
time the macro call runs
[...]
If `initialize' is interpreted, a new list `(nil)' is constructed each
time `initialize' is called.
(elisp "(elisp) Expansion") does mention that uncompiled macro calls
(usually) also get expanded just once:
Note that Emacs tries to expand macros when loading an uncompiled
Lisp file. This is not always possible, but if it is, it speeds up
subsequent execution. *Note How Programs Do Loading::.
Ccing Stefan M, since you made the eager macroexpansion changes as far
as I recall.
This bug report was last modified 3 years and 280 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.