Write Less, Do More (and Have Fun!) with Elixir Macros

Erlang Factory SF, 2014


Elixir macros give programmers the power to write code that writes code. This power eliminates boilerplate, allows Domain Specific Language abstractions, and provides the freedom to extend the language. Leveraging the fact that it can be represented by its own data structures, Elixir can interrogate its own code to peer in for analysis or to add additional functionality. Used appropriately, macros offer effective module composition and code generation techniques, while more liberal use can serve as an outlet for novel insights through experimentation.

Starting from the basics of macros, we’ll explore these ideas from an introductory level through advanced topics and real-world use-cases. Along the way, we’ll see how Elixir uses meta-programming to generate parts of its own standard library. We’ll also examine how macros can be used to save time and share functionality in a fun and productive way.

Whether a beginner or seasoned Erlang developer, you’ll leave with a great overview of what is possible with Elixir macros and, with any luck, a strong desire to keep digging.

Talk objectives:

The goals of this talk are to demonstrate the productive benefits of Elixir macros and how they provide a landscape for writing fun and insightful programs.

Target audience:

This talk is for any seasoned Erlang developer as well as beginners who are interested in the Elixir programming language and what macros have to offer.