Elixir course

Elixir Level 10: Metaprogramming

Metaprogramming is level 10 of 16 of the LoWisa Elixir course. It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

Updated 2026-11-25

Macros

  • Macros. A macro receives code as data and returns code: Elixir extending itself at compile time.
  • AST. Elixir code is quotable AST: three-element tuples the macro system rewrites.
  • Macros in the wild. The ecosystem’s elegance is macros: routers, schemas and tests are macro-built DSLs.

Quote and Unquote

  • quote. quote captures code as AST: the raw material macros transform.
  • unquote. unquote splices values into quoted code: templates filled at compile time.
  • Hygiene. Elixir macros are hygienic: their variables cannot silently capture yours.

Compile-Time Extension

  • use and __using__. use invokes a module’s __using__ macro: the injection point behind every framework DSL.
  • Compile-time checks. Macros can validate at compile time: wrong configuration failing the build, not the runtime.
  • Macro restraint. The first rule of macros: don’t: reach for them when functions provably cannot.

Before and after this level

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.

Frequently asked questions

What does Elixir Level 10: Metaprogramming cover?

Macros, Quote and Unquote, Compile-Time Extension: 3 lessons and 9 ideas.

What should I know before this level?

The level before it, Level 9: Mix & Hex, which covers Projects, Dependencies, Packages and Libraries.

Learn Elixir on your phone

The first level is free. LoWisa is on Google Play and the App Store.