Re: [dev] Interesting post about X11

From: Robert Ransom <>
Date: Tue, 22 Jun 2010 04:38:44 -0700

On Tue, 22 Jun 2010 13:04:10 +0200
Mate Nagy <> wrote:

> On Tue, Jun 22, 2010 at 03:46:16AM -0700, Robert Ransom wrote:
> > It was (at least in that paragraph). See my reply to your other message
> > for three examples of useful SYNTAX-RULES macros; SYNTAX-RULES cannot
> > be implemented properly without a hygienic macro system. I don't think
> > you would actually object to having a hygienic macro system and
> > SYNTAX-RULES *along with* the full compilation-at-compile-time
> > functionality of Common Lisp macros.
> that sounds fine, of course - but can't you implement hygienic macros
> on top of the usual gensym (provided, as it is, that it won't be eq to
> any other symbol)?

Yes, but no one knows how to implement SYNTAX-RULES using GENSYM.
Quoting from “Macros That Work”, by Clinger and Rees:

> It is impossible to construct a pattern-based, automatically hygienic
> macro system on top of syntactic closures because the pattern
> interpreter must be able to determine the syntactic role of an
> identifier (in order to close it in the correct syntactic environment)
> before macro expansion has made that role apparent.

‘Syntactic closures’ essentially wrap each identifier with a mapping of
names to their denotations at the point in the program source where the
identifier appeared. The R6RS-mandated macro system is essentially a
hybrid of syntactic closures with Kohlbecker's ‘painting’ algorithm.

If you want to understand R6RS macros, ask me for a long explanation
sometime -- R6RS refers readers to Oscar Waddell's PhD thesis for the
details of its macro model, and the model in Waddell's thesis is
incompatible with the behaviour required by R6RS. See the r6rs-discuss
archive for February 2010 if it still exists.

Robert Ransom

Received on Tue Jun 22 2010 - 11:38:44 UTC

This archive was generated by hypermail 2.2.0 : Tue Jun 22 2010 - 11:48:02 UTC