3 ms·
> `syntax-rules` is nice, but there's much more powerful and easier to use constructs now, like `syntax-case` and Racket's `syntax-parse`. `syntax-parse` is th
by ashton314 2y ago
> `syntax-rules` is nice, but there's much more powerful and easier to use constructs now, like `syntax-case` and Racket's `syntax-parse`.
`syntax-parse` is the best! I wrote up some notes [1] while trying to figure out the differences between `syntax-case` and `syntax-parse` a year ago. Not the best notes, but there are some examples.
Racket solves the hygiene problem well with scope sets: each identifier gets tagged with the set of scopes it appears in. There's a blog post [2] by Matthew Flatt of Racket fame describing how Racket's scope system works. Thanks to scope sets, I'm not sure this inadvertent variable capture would be a problem.
[1]: https://lambdaland.org/posts/2023-05-19_racket_macros/ https://lambdaland.org/posts/2023-05-19_racket_macros/
[2]: https://users.cs.utah.edu/plt/scope-sets/ https://users.cs.utah.edu/plt/scope-sets/
- DonaldPShimoda 2y ago> There's a blog post by Matthew Flatt of Racket fame describing how Racket's scope system works. For clarity, I would specify that Matthew is the lone conceiver and implementer of the original sets-of-scopes system, as evidenced by him being the only author on the corresponding paper "Binding as Sets of Scopes" (POPL '16, DOI: https://doi.org/10.1145/2914770.2837620 https://doi.org/10.1145/2914770.2837620). So the blog post isn't just "some well-known Racket guy explaining a Racket thing", but rather "the guy who invented the thing explaining the thing". The paper has a corresponding talk as well: https://youtu.be/rs27lkgq3Og https://youtu.be/rs27lkgq3Og. (And, in fact, Matthew has given the talk on more than a few occasions at various venues, so there are other recordings available as well.)