Chapter 8Macros
In this chapter, our programs are going to write Elixir code. That concept may sound strange to you, but thanks to the concept of macros, it’s possible.
Before we get too far down that road, we should issue the standard warning. In Programming Clojure, Third Edition [HB18], Stuart Halloway and Alex Miller of Clojure fame said:
The first rule of Macro Club is Don’t Write Macros.
Sometimes, languages have important features that are rarely used. In the case of macros, they’re important because of their ability to build stunningly beautiful APIs. They’re rarely used because the implementation and maintenance of those beautiful APIs can be complex and awkward. In fact, much of Elixir itself is written in Elixir macros.
Macros are ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access