Hygienic Macros

First implemented (afaik) in Scheme (see DefineSyntax). Hygienic, in reference to a macro system, means that variables defined within macro code are renamed, or subject to some other transformation, in order to avoid name clashes with the code surrounding the macro call site.

In recent years, hygienic macro systems have been implemented in a number of other languages, such as TemplateHaskell [http://www.haskell.org/th/], MetaMl? [http://www.cse.ogi.edu/PacSoft/projects/metaml/], and NemerleLanguage [http://www.nemerle.org].

This isn't exactly true. In TemplateHaskell variables aren't hygienic, you need to use the genSym operation of the quotation monad.

Variable created using default quotation syntax (limited to some subset of language) is hygienic in TemplateHaskell. Although in constructs, which cannot be handled be default syntax, it is necessary to make it hygienic using genSym.


CategoryLanguageFeature


EditText of this page (last edited September 8, 2004) or FindPage with title or text search