[r6rs-discuss] [Formal] Remove double phase semantics (fwd)
Andre van Tonder
andre at het.brown.edu
Sun Nov 26 16:33:00 EST 2006
On Sun, 26 Nov 2006, William D Clinger wrote:
> Are you sure that example is legal with the separated
> binding semantics? It looks to me as though the m
> macro transcribes uses of m into a macro-time integer,
> which has nothing whatsoever to do with a run-time
> integer, and *must* therefore cause a syntax error.
> For your example to work *at all* with the separated
> binding semantics, the macro expander would have to
> perform an automagical transformation from macro-time
> representations to run-time representations.
> I repeat my questions: Does your reference implementation
> perform that transformation? If so, how?
It does so in the usual way in implementations that separate compilation and
execution, by embedding the integer literal in generated code that can
be executed in a lower phase. This is the only communication between phases
possible that does not involve the external world (e.g., the file system).
With the given specification of syntax-case, this magical transformation from
Scheme value to Scheme code may be thought of as occurring when the
expansion algorithm receives the output of a transformer.
This reflection from values to code is only possible for certain literals,
because the syntax object that is the output of a transformer may contain
the types of literals that may occur in valid Scheme code. It is not possible
for arbitrary values, such as user-defined records, ports, etc., that do not
map into valid Scheme expressions.
More information about the r6rs-discuss