Sponsored Link • In the last dozen episodes I have defined
plenty of macros, but I have not really explained what macros
are and how they work. This episode closes the gap: it explains
the true meaning of Scheme macros by introducing the concepts of
syntax object and of transformer over syntax objects. Scheme
macros - as standardized in the R6RS document - are built over
the concept of syntax object. The concept is peculiar to Scheme
and has no counterpart in other languages (including Common
Lisp), therefore it is worth to spend some time on it. A syntax-
object is a kind of enhanced s-expression: it contains the
source code as a list of symbols and primitive values, but also
additional informations, such as the name of the file containing
the source code, the position of the syntax object in the file,
a set of marks to distinguish identifiers according to their
lexical context, and more. The easiest way to get a syntax
object is to use the syntax quoting operation, i.e. the syntax
(#') symbol you have seen i