[racket] question about macro failing due to hygiene(?)

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Jan 16 04:02:52 EST 2012

A few minutes ago, Marijn wrote:
> And so it does, but even in the simplified example I find it hard to
> reason about it and come to a conclusion on whether it should return
> 1 or 2.

Yes, it is a little tricky.

> Do you just look at:
>          (define-syntax-rule (make-variable __E__)
>            (lambda () (let ([_id_ 1]) __E__)))
> and say "__E__ and _id_ are not introduced by the same syntax-rule
> pattern, so by hygiene _id_ is not free in __E__ and thus (let ((_id_
> 1)) ...) cannot bind anything in __E__" or how does it work?

This sounds like a valid intuition.

(BTW, if it was't clear, the above could be fixed by making `_id_' an
input to the `make-variable' macro, which should be easy to do in your
original code too.)

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

Posted on the users mailing list.