Hygienic macro

In computer science, hygienic macros are macros whose expansion is guaranteed not to cause the accidental capture of identifiers. They are a feature of programming languages such as Scheme,[1] Dylan,[2] Rust, Nim, and Julia. The general problem of accidental capture was well known in the Lisp community before the introduction of hygienic macros. Macro writers would use language features that would generate unique identifiers (e.g., gensym) or use obfuscated identifiers to avoid the problem. Hygienic macros are a programmatic solution to the capture problem that is integrated into the macro expander. The term "hygiene" was coined in Kohlbecker et al.'s 1986 paper that introduced hygienic macro expansion, inspired by terminology used in mathematics.[3]

  1. ^ Cite error: The named reference r5rs was invoked but never defined (see the help page).
  2. ^ Feinberg, N.; Keene, S. E.; Matthews, R. O.; Withington, P. T. (1997), Dylan programming: an object-oriented and dynamic language, Addison Wesley Longman Publishing Co., Inc.
  3. ^ Kohlbecker, E.; Friedman, D. P.; Felleisen, M.; Duba, B. (1986). "Hygienic Macro Expansion" (PDF). ACM conference on LISP and functional programming.