A theory of hygienic macros

  • Authors:
  • David Herman;Mitchell Wand

  • Affiliations:
  • College of Computer and Information Science, Northeastern University, Boston, MA;College of Computer and Information Science, Northeastern University, Boston, MA

  • Venue:
  • ESOP'08/ETAPS'08 Proceedings of the Theory and practice of software, 17th European conference on Programming languages and systems
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

Hygienic macro systems, such as Scheme's, automatically rename variables to prevent unintentional variable capture--in short, they "just work." Yet hygiene has never been formally presented as a specification rather than an algorithm. According to folklore, the definition of hygienicmacro expansion hinges on the preservation of alpha-equivalence. But the only known notion of alpha-equivalence for programs with macros depends on the results of macro expansion! We break this circularity by introducing explicit binding specifications into the syntax of macro definitions, permitting a definition of alpha-equivalence independent of expansion. We define a semantics for a first-order subset of Scheme-like macros and prove hygiene as a consequence of confluence.