[r6rs-discuss] Macro Timing and the Art of the Meta-Circular Interpreter
John Cowan
cowan at ccil.org
Wed Oct 28 13:05:21 EDT 2009
David Rush scripsit:
> Which is all well and good, but what does any of this have to do with
> macros? Early Lisps treated macros as syntactic abstractions and
Rather, early Lisps treated them as *procedural* abstractions and ...
> therefore incorporated their reduction into the APPLY function.
> This led us to FEXPRs,
FEXPRs were there from the Lisp 1.5 days; macros came much later.
> However, it seems that macros could also be
> viewed as syntactic *extensions* and as such be more properly
> considered as part of EVAL's functional remit.
That is in fact the realization that led to the abolition of user-written
FEXPRs from Common Lisp and Scheme: that macros do everything FEXPRs do
that's worthwhile, and are far more tractable. (You still need some
primitive FEXPRs, now renamed "syntax" in Scheme and "special forms"
elsewhere.)
> From this view it seems that we ultimately derive hygienic macros -
> as their reduction can be accomplished entirely in terms of textual
> manipulation with only minimal (actually zero I think) reference to
> anything outside of the syntactic reduction machinery in the MCI.
Well, it depends. Certainly true for syntax-rules, but low-level macro
systems (hygienic or not) depend on the whole Lisp system, since they
provide access to the entire language to construct the macro. (ISLisp is
an exception; only a subset of ISLisp is available at macro expansion
time; roughly speaking, nothing that can side-effect the environment in
which the macro expander is executing.)
> Now it is interesting to note that hygienic macros float the syntactic
> extension functionality outside of the entire EVAL/APPLY loop and into
> a conceptually separate pass.
That's true of any macros whatsoever; it is, in some sense, the point of
macros. It's possible to intertwine that pass with ordinary evaluation,
as SCM shows, but at a high price in conceptual machinery.
> This makes environmental manipulations completely impossible to the
> macro processor.
Again, not so. That's a matter of level. C macros can't do environmental
manipulation because they are high-level, not because they are hygienic
(they aren't).
It's very important not to conflate hygiene with level -- they are
utterly orthogonal.
--
Yes, chili in the eye is bad, but so is your John Cowan
ear. However, I would suggest you wash your cowan at ccil.org
hands thoroughly before going to the toilet. http://www.ccil.org/~cowan
--gadicath
More information about the r6rs-discuss
mailing list