# SRFI 72: Hygienic macros

by André van Tonder

status: final (2005-09-21)

keywords: Syntax

## Abstract

This SRFI describes a procedural macro proposal for Scheme with the following features:

• ### Improved hygiene:

We argue that conventional hygiene algorithms may lead to accidental variable capture errors in procedural macros. We propose an improved algorithm that avoids these problems.

• ### Reflective tower:

We specify a reflective tower of arbitrary height, and propose a refinement of lexical scoping that takes into account the phase of use of an identifier in determining its meaning.

• ### Syntax-case:

In the current proposal, the syntax-case form is expressible as a macro in terms of a simpler set of primitives and is specified as library syntax.

• ### Procedural interface:

The primitive interface for manipulating compound syntax objects consists of procedures rather than special forms. In particular, the traditional abstractions car, cdr, cons , ... can be used on syntactic data.

• ### Fast hygiene algorithm:

The reference implementation documents a fast imperative hygiene algorithm that is eager and linear in expression size.

• ### Capturing identifiers:

A primitive make-capturing-identifier is provided for intentional variable capture and for building expansion-time fluid binding constructs.