3 ms·
In the simplest case, a macro system gives rise to two-phase evaluation - first, there is code that runs at macro expansion time, that produces, as its result,
by dbpatterson 9y ago
In the simplest case, a macro system gives rise to two-phase evaluation - first, there is code that runs at macro expansion time, that produces, as its result, new syntax, and second, that resulting code runs. But having just two phases is (needlessly) restrictive, because you might want macros that generate other macros (and so the macro-generating macros would need to run at an earlier phase than the generated ones).
- chongli 9y agoWouldn't the macro-expansion phase be run until it reaches a fixed point? That way all macros could be fully expanded before proceeding to the next phase.
- wtetzner 9y agoI believe that's how macros in Racket work, but each iteration is considered a separate phase. At least, that's how I understood it. This page has some useful information about phases: https://docs.racket-lang.org/guide/phases.html https://docs.racket-lang.org/guide/phases.html