A Theory of Hygienic Macros

The work

AuthorsDavid Herman; Mitchell Wand
Editors
Typeincollection
Year2008
Citekeyherman2008theory

Where it appeared

Published in17th European Symposium on Programming (ESOP)
PublisherSpringer
SeriesLecture Notes in Computer Science
Pages48--62

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 hygienic macro 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.

How it got here

How it got hereagent via unpaywall
Added2026-08-05 00:00 UTC
Approved bya person 2026-08-21 05:51 UTC

Filed under

drheap esop lncs

Cite it as

@incollection{herman2008theory,
  title        = {A Theory of Hygienic Macros},
  author       = {David Herman and Mitchell Wand},
  year         = {2008},
  booktitle    = {17th European Symposium on Programming (ESOP)},
  publisher    = {Springer},
  series       = {Lecture Notes in Computer Science},
  pages        = {48--62},
  doi          = {10.1007/978-3-540-78739-6_4},
}

This record lives at https://refs.drheap.org/herman2008theory/ and will keep doing so.