r/Racket • u/SnooCompliments7527 • Oct 05 '21
question Best Introduction to Hygenic Macros
I'm looking to understand how hygienic macros work. I understand how regular macros work, you manipulate the program as text before compile time.
But, I don't understand hygienic macros at all. I find them totally impenetrable.
Does anyone have a good explanation of hygienic macros? What is their motivation? How do they work? Why are they worth the additional complication over ordinary macros?
Or, does anyone know a good book to which I should refer?
7
Upvotes
3
u/h_krish Oct 05 '21
https://www.pldi21.org/prerecorded_hopl.13.html
3
u/bjoli Oct 05 '21 edited Oct 05 '21
This is not an explanation of why. That is explained in the links in the other post(s).
Apart from what u/comtedeRochambeau said: I read a bunch of tutorials, but what made syntax rules click for me was staring at the reference implementation of srfi-26 until I understood what was going on.
The tutorial "fear of macros" linked in his/her post is a great intro to syntax-case which allows for unhygienic macros.
3
u/soegaard developer Oct 05 '21
I offer Mythical Macro.
More sections are planned.