Jump to ratings and reviews
Rate this book

Metaprogramming Elixir

Rate this book
Metaprogramming is one of Elixir’s greatest features. Maybe you’ve played with the basics or written a few macros. Now you want to take it to the next level. This book is a guided series of metaprogramming tutorials that take you step by step to metaprogramming mastery. You’ll extend Elixir with powerful features and write faster, more maintainable programs in ways unmatched by other languages.

You’ll start with the basics of Elixir’s metaprogramming system and find out how macros interact with Elixir’s abstract format. Then you’ll extend Elixir with your own first-class features, write a testing framework, and discover how Elixir treats source code as building blocks, rather than rote lines of instructions. You’ll continue your journey by using advanced code generation to create essential libraries in strikingly few lines of code. Finally, you’ll create domain-specific languages and learn when and where to apply your skills effectively.

When you’re done, you will have mastered metaprogramming, gained insights into Elixir’s internals, and have the confidence to leverage macros to their full potential in your own projects.

106 pages, Paperback

First published January 27, 2015

Loading interface...
Loading interface...

About the author

Chris McCord

2 books19 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
82 (49%)
4 stars
64 (38%)
3 stars
17 (10%)
2 stars
2 (1%)
1 star
0 (0%)
Displaying 1 - 12 of 12 reviews
Profile Image for Sebastian Gebski.
1,043 reviews1,021 followers
September 22, 2015
VERY much needed book - the best resource on Elixir metaprogramming I've found so far.

Until 50% it's well understandable even for someone who doesn't consider himself Master Alchemist yet ;), but since 50% you seriously should be beyond some step to grasp it. I was _struggling_ a lot & for sure I can't say I've won, but even if macroing Elixir isn't all that natural for me & I didn't switch to functional metaprogramming with DSLs only yet, it was a very useful journey. Or rather - a fruitful beginning of a very promising journey.

Truly recommended for anyone trying to elevate their Elixir-fu to the next level.
Profile Image for Héctor Iván Patricio Moreno.
367 reviews20 followers
January 8, 2019
This book is an awesome read if you're new to Elixir or haven't experimented with the metaprogramming parts of Elixir.

It's often times said that books are the cheapest objects you could acquire because of all the knowledge you could get from them, and with this book that saying holds true.

This is a short but very very instructive book filled with deep practical knowledge Elixir and its code generation capabilities and an expert guide from the basics to the very advanced, step by step.

If you want to improve not only as an Elixir programmer but as a programmer in general, you should read this book and try to replicate and complete the exercises proposed.

I cannot say I understood everything totally but as the book says, nothing can replace experimentation driven knowledge.
11 reviews28 followers
July 9, 2019
There were a lot of good insights, the examples he picked were excellent and I really liked them, however one nitpick would be the way he presents that information to you.

Chris basically gives you a big block of code and have you run that code, then only explains it to you after the fact. While there's nothing really wrong with that approach, I would've liked it more if he had presented the problems of what we're trying to solve. For example, explaining the problem and why we need to use `bind_quoted` to solve it, instead of throwing `bind_quoted` and saying this is what it does. Subtle difference, but I would've liked a problem-framing approach rather than a explain approach.
Profile Image for Mike Zornek.
56 reviews6 followers
July 4, 2022
I'm going to mark this read though I only finished two-thirds of it. Kind of fell off my radar and have moved on.

From what I read, I enjoyed it. I don't do a lot of metaprogramming in Elixir but the book did give me an appreciation for how well the language works with it. In fact, considering so much of the internals of Elixir itself are built using metaprogramming I'm sure what I've learned will help me read Elixir source code over time.

I may come back to this book in the future if I find myself in need but for now, am moving on to other books.
Profile Image for Niklas.
23 reviews
February 6, 2022
The good parts are great! Really great. I learned a lot. Unfortunately it feels like the book was a little rushed. There were some "clear" typos and errors in the examples. Which brings down the overall rating for the book. Moreover, it feels like some areas are completely skipped. I really hope they can make a second edition.
Profile Image for John.
37 reviews2 followers
February 13, 2022
The book provides nice examples of the tricks you can do with the help of macros in Elixir. And is worth to get back to when you need to implement a similar thing in your work. Unfortunately, after finishing the last chapter I still haven't understood the inner workings of macros.
Profile Image for Mark.
63 reviews1 follower
March 23, 2016
I wasn't too much a fan of the writing style -it lends itself towards fanboy-isms and hyperbole on occasion- but technically speaking, I couldn't have asked for a better walk through of how macros work in Elixir. Some of the examples are advanced -as in, probably something you would never write unless you were developing a web framework like Chris did, but other than that I found it an interesting subject for 100 or so pages.
Profile Image for Suvash Thapaliya.
24 reviews4 followers
July 21, 2015
I read this right after finishing the book on Clojure Macros (Pragmatic Programmers). It's interesting how Elixir's macro system almost talks and walks like a Lisp macro, but not quite. This book is a ton of fun, and has practical examples.
Profile Image for Kenny Parnell.
200 reviews7 followers
July 31, 2016
Excellent book. The perfect follow up for Programming Elixir. It really helped me to dig into the language and deepen my understanding.
Displaying 1 - 12 of 12 reviews

Can't find what you're looking for?

Get help and learn more about the design.