Skip to content
This repository was archived by the owner on Jun 24, 2018. It is now read-only.

Latest commit

 

History

History
23 lines (18 loc) · 674 Bytes

_14_summary.md

File metadata and controls

23 lines (18 loc) · 674 Bytes
  • Elixir compilation is 3 phased

    • Parsing, Expansion, Byte code generation
    • Expansion happens recursively
    • Metaprogramming in Elixir happens in the Expansion phase
  • defmacro

    • is called during the expansion phase of the Elixir compiler
    • receives it's arguments as an AST
    • results are exanded & inlined
  • Macros

    • are hygienic by default
    • but you can disable that (if you need to)
  • quote

    • creates an AST fragment
    • A tree of 3 element tuples (operation, context, arguments)
  • unquote

    • wraps existing terms for injection into an AST fragment
  • WTF is going on?

    • Macro.expand, Macro.expand_once & Macro.to_string are your friends