~/talk

How I learned to stop worrying and love macros

Talkat Alchemy Conf 2021 · 2021-05-14..05-15· [elixir-and-erlang]
name:Evadne Wu
links:none on file
slides:none on file

Explains exactly how Elixir macros generate real code: use of __using__ to inject functions, quote/unquote and unquote_splicing to build AST, and before_compile plus module attributes to collect rules then emit final functions. Shows decoding generated bytecode from Gettext to inspect the compiled functions, compares macro generation with EEx template codegen, and demos a firewall DSL that compiles CIDR/range rules into pattern-matched functions. Advises sparing use, notes macros speed runtime and reduce duplication but can obscure debugging.

AI-written summary · about

  1. 0:00Introduction to macros
  2. 1:21Why use meta programming
  3. 5:23Macros and code generation
  4. 12:37Using macros in practice
  5. 17:37Detecting and defining functions
  6. 23:29Before compile hooks
  7. 26:19Overusing macros
  8. 28:04Code generation with EEx
  9. 29:30Debugging generated code
  10. 36:07Splitting implementations across files
  11. 39:40Macros and maintenance
  12. 44:20DSLs with macros
  13. 56:51Wrap up and resources
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.