Go to the first, previous, next, last section, table of contents.


Compiling Macros

Although it may seem odd that macros return a form to produce a result and not simply the result this is their most important feature. It allows the expansion and the evaluation of the expansion to happen at different times.

The Lisp compiler makes use of this; when it comes across a macro call in a form it is compiling it uses the macroexpand function to produce the expansion of that form which it then compiles straight into the object code. Obviously this is good for performance (why evaluate the expansion every time it is needed when once will do?).

Some rules do need to be observed to make this work properly:


Go to the first, previous, next, last section, table of contents.