Now that we understand how source code is represented as abstract syntax trees, we can start doing more interesting things by writing macros. In this section, we will learn what macros are and how to work with them.
Developing macros
What are macros?
Macros are functions that accept expressions, manipulate them, and return a new expression. This is best understood with a diagram:
As we know, expressions are just abstract syntax tree representations of source code. So the macro facility in Julia allows you to take any source code and generate new source code. The resulting expression is then executed as if the source code was written directly in place.
At this point, you may wonder why we cannot use regular functions...