In
my
last post, I talked about macros and referential auxiliary
identifiers—what we usually call a macro’s “literals.” Scheme
macro systems only get it half right, though, because while they
compare identifiers using referential equality (i.e., using the
free-identifier=? predicate), they allow literals to refer to
nonexistent bindings. While the comparison is well-defined via the
definition of free-identifier=?, at a higher level the idea
is nonsensical.
In contrast, syntax-parse requires that every literal
refer to some binding. (I’ll sometimes refer to this requirement as
the is-bound property for short.) This requirement is
problematic in a different way. Specifically, this property cannot be
checked statically (that is, when the syntax-parse expression
containing the literal is compiled).
That might strike you as bizarre or unlikely. After all, you can
easily imagine checking that a syntax-rules macro, say,
satisfies the is-bound property. But in Racket, not every macro
uses syntax-rules, and—more importantly—not every bit of
syntax-analyzing code is a macro. And both of these facts have to do
with phases.