Strange Loop

2009 - 2023

/

St. Louis, MO

Let's Build a Hygienic Macro Expander

Although the idea of hygienic macro expansion appeals to many programmers, the details of hygienic expansion have scared away many language implementors. In fact, in the same way that lexical scope used to seem exotic and difficult to implement compared to dynamic scope---at least, until its implementation via closures became widely understood---the extra dimension of "macro scope" can seem mysterious. Historically, dynamic scope seemed obvious, because it involves a linear sequence of bindings, while lexical scope demands an implementation that matches the two-dimensional nature of nested expressions. Macro scope demands yet another dimension to binding.

This talk aims to dispel the mystery of hygienic expansion: first, through a new explanation of macro scope based on "scopes sets"; and second, by walking through the implementation of a macro expansion using scope-sets.

Matthew Flatt

Matthew Flatt

Racket and University of Utah

Matthew Flatt is a professor in the School of Computing at the University of Utah, where he works on extensible programming languages, run-time systems, and applications of functional programming. He is one of the developers of the Racket programming language.