Hacker News new | ask | show | jobs
by dbpatterson 3314 days 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).
1 comments

Wouldn'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.
I 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