[racket] Another macro question: making a lexically binding keyword?

From: Eli Barzilay (eli at barzilay.org)
Date: Wed May 9 05:02:10 EDT 2012

A week ago, Laurent wrote:
> Hi,
> 
> I didn't fully read Eli's very detailed answer, so hopefully I won't
> repeat what he said.
> 
> Here, to me it seems the right approach is to keep hygiene, so that
> you can scope your INDEXes as you want, and so that you know exactly
> what happens without needing to know the details of `ranged' and
> `interfere' to know where your indexes are bound: [...]

Yes, that's a common way to deal with these problems, but it doesn't
work well. You basically end with writing these names all over the
place, which can become a real problem when you want to build a
language with these things.  In our syntax parameters paper there is
an example that shows how awkward it can get -- say that you have an
anaphoric conditional that binds an `it', and a `loop' that binds
`abort'.  If you want to implement a `while' loop that uses both, then
uses of your macro would look like:

  (while abort it
    ... code that can use `abort' and/or `it' ...
    )

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

Posted on the users mailing list.