Hi all, I recently posted two tricky hygiene puzzles on Twitter <https://twitter.com/lexi_lambda/status/1420221128245714951>, reproduced below for completeness:
(let ([x 'outer]) (define-syntax-rule (m a) (let ([a 'inner]) x)) (m x)) (let ([x 'outer]) (define-syntax-rule (m a) (begin (define a 'inner) x)) (m x)) The puzzle is to guess what these expressions evaluate to. I have discovered that people find the “correct” answer *remarkably* unintuitive—at the time of this writing, it is the single least popular choice in the poll! Despite this confusion, the Scheme implementations I’ve tried are unwaveringly consistent in their interpretation of these expressions: Racket, Chez, and Guile all agree on what the answers should be. This has led me to wonder where the original justification for these answers comes from, but I have been struggling to hunt down a source. Matthew’s 2016 paper, “Bindings as Sets of Scopes”, discusses examples like these ones in gory detail, but it gives no justification for *why* these results are the right ones, it simply takes their meaning for granted. Earlier papers on macro technology I have found do not discuss internal definitions, and no Scheme standard specifies the macro system, not even R6RS. Obviously, something at some point must have set the precedent for the handling of such macros, but I cannot figure out what it is. So, my question: when was hygiene for internal definitions first worked out, and did it make it into any papers, specifications, or documentation? Hopefully someone (probably Matthew) can provide some insight. Thanks, Alexis -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAA8dsac6XUYpcMzf5dG5oSWKw30jZGOgqCPFMiEOTcq1KAh1Bw%40mail.gmail.com.