What Are Elixir Macros, The Most Powerful Elixir Feature — Tentamen Software Testing Blog

Elixir Macro Run in IEx

TL;DR

In the previous post, we presented Elixir operators, where many of them are Elixir Functions. Today we present the most powerful Elixir Feature, Macros. This post is part of the functional language series, and it is based on the remarkable book Elixir In Action by Sasa Juric.

Transformations On Compile Time

Elixir Macro is a function that on compile-time inputs transforms into Elixir code. This is what Computer Virus does but in program runtime. Let’s present Elixir Macros as the example of an if statement. If statement is not a core part of Elixir language. It is Elixir Macro.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store