In modern Scheme, a macro captures the lexical environment where it is defined. This creates an opportunity for extending Scheme so that macros are first-class values. The key to achieving this goal, while preserving the ability to compile programs into reasonable code, is the addition of a type system. Many interesting things can be done with first-class macros, including the construction of a useful module system in which modules are also first-class.
Here is the paper as it appeared in POPL 2000: In PostScript (59K).
Here is the current code distribution. Anyone trying to understand this code may find it useful to start by reading this earlier system of mine that uses many of the same techniques for implementing macros, and that is much more extensively commented.
Clams got legs!