We will now analyze how we can develop code that writes code for us, before being finally transformed into BEAM bytecode. This will let us extend Elixir, inject new code into existing modules, and even write a domain-specific language to simplify our media pipeline definitions.
What you will see through this chapter is only possible due to the incredible tools Elixir gives us to manipulate the abstract syntax tree just before it is turned into bytecode. Let's jump right into it!
In this chapter, we'll cover the following:
- What is an abstract syntax tree and how to access it?
- Using the special forms quote/2 and unquote/1
- Macro hygiene and the caller and macro contexts
- Applying use and its __using__/1 function
- Using module attributes to collect information about the caller module
- Creating a domain-specific language with...