This chapter will discuss two of the most powerful facilities in the Julia programming language: macros and metaprogramming.
In a nutshell, metaprogramming is a technique for writing code that generates code—that's why it has the prefix meta. It may sound esoteric, but it is a fairly common practice in many programming languages today. For example, C compiler uses a preprocessor to read source code and produce new source code, and then the new source code is compiled into a binary executable. For example, you can define a MAX macro, as in #define MAX(a,b) ((a) > (b) ? (a) : (b)), and this means that every time we use MAX(a,b), it is replaced with ((a) > (b) ? (a) : (b)). Note that MAX(a,b) is much easier to read than the longer form.
The history of metaprogramming is quite long. As far back as the...