status: final (2005-09-21)
keywords: Syntax
This SRFI describes a procedural macro proposal for Scheme with the following features:
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.
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.
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.
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.
The reference implementation documents a fast imperative hygiene algorithm that is eager and linear in expression size.
A primitive
make-capturing-identifier
is provided for intentional
variable capture and for building expansion-time fluid binding
constructs.