[racket] question about macro failing due to hygiene(?)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 13-01-12 21:24, Eli Barzilay wrote:
> Three hours ago, Marijn wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>
>> Why doesn't this work (expand: unbound identifier in module in:
>> a): [...]
>
> Similar to the reason that this:
>
> (define-syntax make-store (syntax-rules () [(_ _id_ _E_) (let ()
> (define-syntax-rule (make-variable __E__) (lambda () (let ([_id_
> 1]) __E__))) (define store (let ([_id_ 2]) (make-variable _E_)))
> store)])) ((make-store a a))
Thanks for the simplified example.
> returns 2 and not 1.
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.
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?
Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk8T5b4ACgkQp/VmCx0OL2ywnwCghDb8RAlKE6VyG5wtcpA0c+Bk
VtIAniM6xi9IAvbqLpMEvGkuW9XqiUlh
=xVfz
-----END PGP SIGNATURE-----