Re: [racket-users] syntax/parse is not hygienic

2018-03-05 Thread Yucheng Zhang
On Monday, March 5, 2018 at 6:36:09 PM UTC, Alexis King wrote: > I will say this, however: while I have developed over the years a reasonably > strong intuition for how Racket macros operate, when I was learning the macro > system for the first time, I did not find some parts of the hygiene

Re: [racket-users] syntax/parse is not hygienic

2018-03-05 Thread Alexis King
For those interested, it turns out you can get a loose approximation of the van Tonder system in Racket in just a few dozen lines of code. Namely, you can write a helper that undoes the macro-introduction scope added by the Racket macro system: (begin-for-syntax (define

Re: [racket-users] syntax/parse is not hygienic

2018-03-05 Thread Alexis King
Thank you to both of you for your detailed responses! I think this is all fascinating. > On Mar 5, 2018, at 05:18, Ryan Culpepper wrote: > > 1. Yes. To me, at least :) That aspect of hygiene is triggered by a > macro expansion step, and the macro expansion step also defines

Re: [racket-users] syntax/parse is not hygienic

2018-03-05 Thread Matthew Flatt
At Sun, 4 Mar 2018 20:01:56 -0800, Alexis King wrote: > While it’s a bit of a tangent, I’d be quite interested to finding more > information on this alternate model of hygiene from anyone familiar with > the tradeoffs (the SRFI that describes it does not include much in the > way of comparisons).

Re: [racket-users] syntax/parse is not hygienic

2018-03-05 Thread Ryan Culpepper
On 03/04/2018 09:40 PM, Alexis King wrote: [... context ...] Still, with all this context out of the way, my questions are comparatively short: 1. Is this lack of hygiene well-known? I did not find anything in Ryan’s dissertation that explicitly dealt with the question, but I

Re: [racket-users] syntax/parse is not hygienic

2018-03-04 Thread Alexis King
Actually, what I wrote was wrong. The key piece of information I overlooked was the following rule: > A binding for an identifier can only capture a reference to another > if both were present in the source or introduced during a single > evaluation of a syntax or quasisyntax form, with the

Re: [racket-users] syntax/parse is not hygienic

2018-03-04 Thread Alexis King
> On Mar 4, 2018, at 15:11, Matthew Flatt wrote: > > I think scope-flipping would work, but FWIW, I thought you were going > a different direction here. The scope-flipping approach is a way to > infer an intended scope dynamically. It sounds to me like you want > something

Re: [racket-users] syntax/parse is not hygienic

2018-03-04 Thread Matthew Flatt
At Sun, 4 Mar 2018 12:40:43 -0800, Alexis King wrote: > 2. Are there some fundamental, theoretical obstacles to making a > syntax class-like thing hygienic that I have not foreseen? Or would > it really be as simple as performing the usual scope-flipping that > macroexpansion

Re: [racket-users] syntax/parse is not hygienic

2018-03-04 Thread Matthias Felleisen
> On Mar 4, 2018, at 3:40 PM, Alexis King wrote: > > Apologies in advance for both the inflammatory subject and yet another > overly long email to this list. I wouldn’t call this inflammatory. It might be considered a bug report. Thanks for the thorough analysis.

[racket-users] syntax/parse is not hygienic

2018-03-04 Thread Alexis King
Apologies in advance for both the inflammatory subject and yet another overly long email to this list. I think anyone who knows me knows that I love syntax/parse — I think it’s far and away one of Racket’s most wonderful features — but I’ve long suspected it does not respect hygiene. Consider: