A Theory of Hygienic Macros. Herman, D. & Wand, M. In Programming Languages and Systems 17th European Symposium on Programming, ESOP 2008, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2008, Budapest, Hungary, March 29-April 6, 2008., volume 4960, of Lecture Notes in Computer Science, pages 48-62, Berlin, Heidelberg, and New York, 2008. Springer-Verlag. http://dx.doi.org/10.1007/978-3-540-78739-6_4
A Theory of Hygienic Macros [pdf]Paper  abstract   bibtex   
Hygienic macro systems automatically rename variables to prevent unintentional variable capture-- in short, they "just work." But hygiene has never been presented in a formal way, as a specification rather than an algorithm. According to folklore, the definition of hygienic macro expansion hinges on the preservation of alpha-equivalence. But the only known definition of alpha-equivalence for Scheme depends on the results of macro expansion! We break this circularity by introducing binding specifications for macros, permitting a definition of alpha-equivalence independent of expansion. We define a semantics for a first-order subset of Scheme macros and prove hygiene as a consequence of confluence.

Downloads: 0