[racket] tutorial: exploring the boundaries of outer space

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Apr 11 10:48:49 EDT 2012

10 minutes ago, Brian Mastenbrook wrote:
> On Apr 11, 2012, at 7:45 AM, Danny Yoo wrote:
> 
> > Yikes.  Yes, that's unexpected.  Nice catch!
> 
> Hi Danny,
> 
> I confess that I had hidden motives in raising this scenario.

Heh, this came in as I wrote the other reply.


> What happened in this case is most definitely intended behavior for
> syntax parameters. This particular kind of weirdness is exactly the
> kind of brokenness you get from unhygienic insertion in Common Lisp,

Obviously: the lack of hygiene in CL means that you can do this for
*all* "identifiers" (since they're not really identifiers).  Syntax
parameters makes it possible to do the same, only limit the effect to
specific identifiers that are declared as syntax parameters.


> They don't compose very well, since as a macro author I can't use a
> macro which uses syntax parameters without those parameters becoming
> part of the interface of my own macro.

Right -- exactly like plain parameters.  (And you might as well not
like them either.)


> The only way that I can see to avoid exposing this is to have `m'
> carefully capture and restore the values of any parameters used by
> `def', which is an extremely fragile solution.

(Same here -- I don't think that this is any more fragile than the
same with plain parameters...)


> In this particular case, I think the "ordinary" datum->syntax
> insertion version of `def' behaves much more intuitively than the
> syntax-parameterized version [...]

I obviously disagree with this... as we've shown in many examples.
(And we've also shown that the purist stick-to-hygiene solution of
putting the names up-front in all macro uses doesn't work either.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.