[plt-scheme] Breaking hygiene

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Wed Apr 13 07:57:50 EDT 2005

On Wed, 2005-04-13 at 12:17 +0100, Matt Jadud wrote:
> #`(define #,(syntax-object->datum generated-foo)
>      #,wrapped-body)
> 
> where 'generated-foo' might expand to an identifier 'foo'. However, any 
> references to 'foo' in the body will *not* be the same 'foo', as they 
> exist at two different times in the expansion tower. Furthermore, if I 
> were to make the introduced identifier the same as the identifier found 
> in the 'wrapped-body', then I would be breaking hygiene.
> 
> Is this correct? That is, I am trying to break hygiene, yes?

If you want to expand to something like this:

(define (foo) body)

where any occurences foo in body are bound by the define, and foo is an
identifier you chose, not an input to the macro, then yes, you are
trying to break hygiene.  

> PS. Perhaps another thread, but how do people develop and debug 
> significant macros? Or, do they just "get it right" the first time around?

I recommend the syntax-browser from Planet (v300).  And they definitely
don't get it right the first time.

sam th



Posted on the users mailing list.