help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: [External] : Re: Passing result of macroexpand-all as argument to a


From: Drew Adams
Subject: RE: [External] : Re: Passing result of macroexpand-all as argument to a function
Date: Wed, 9 Aug 2023 21:24:36 +0000

> The usefulness of macroexpand seems to be the ability to output
> up to a specific expansion level, that's all.

Two main uses of macro expansion:

1. For coders, to debug their macro definitions.
Expansion lets you see the code you're telling
the macro to produce.

2. For byte-compilation, so for performance.
As I mentioned the expanded code gets substituted
for the source macro call, in line.  (Nay, its
byte-compilation gets substituted.)

For #1 you as a developer call `macroexpand'.
For #2 code in the byte-compiler calls it (in
effect).

> > If you byte-compile the Lisp source code then the
> > macro call gets macroexpanded during compilation,
> > and the result of expansion is then compiled to
> > produce the byte-compiled code. In effect, the
> > macro-call source code disappears and is replaced
> > by the expansion, in line, and the resulting code
> > is then byte-compiled.

reply via email to

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