Re: [racket-users] Hygiene for a curried macro

2020-09-30 Thread rocketnia
Thanks Philip and Ryan, I do need to get more familiar with the macro stepper. :) I tried it out for maybe the first time just now, but I think Philip's screenshot already helped me understand what's going on. I recall that when Racket invokes a macro, it puts a scope on the inputs first (the

Re: [racket-users] Hygiene for a curried macro

2020-09-30 Thread Ryan Culpepper
Yes, the behavior you're seeing is a consequence of hygiene, and you should see the same behavior in other Scheme implementations. When the expander gets to the `let-third` call, there is a `var` identifier in the macro's template that is used as a binder, and there is a `var` identifier in the ma

Re: [racket-users] Hygiene for a curried macro

2020-09-30 Thread Philip McGrath
I'll also put in a plug for DrRacket's Macro Stepper, which can show your scopes in pretty colors! (And precise numbers.) In particular, in the "Stepper > Foreground colors" menu, you can toggle between "By macro scopes" and "By all scopes". [image: Screen Shot 2020-09-30 at 3.47.40 AM.png] -Phili

Re: [racket-users] Hygiene for a curried macro

2020-09-30 Thread Philip McGrath
Hi Nia, Here's a variant that passes your test: #lang racket (require rackunit syntax/parse/define) (define-syntax let-second-and-create-let-third (syntax-parser [(_ var let-third body-of-let-second) #'(let ([var "second"]) (let-syntax ([let-third

[racket-users] Hygiene for a curried macro

2020-09-29 Thread rocketnia
Hi all, I've been experimenting with a custom system of managed local variables, and I came up with a hygiene test case that was failing. So then I tried the same test case with plain Racket variables, and it failed that way too. Here's a minimalistic example. Basically, this is a curried mac