https://github.com/curiosum-dev/elixir-macros-metaprogramming
A companion repository to our article at Curiosum: https://curiosum.dev/blog/elixir-trickery-using-macros-metaprogramming?utm_source=github&utm_medium=social
https://github.com/curiosum-dev/elixir-macros-metaprogramming
Last synced: 4 months ago
JSON representation
A companion repository to our article at Curiosum: https://curiosum.dev/blog/elixir-trickery-using-macros-metaprogramming?utm_source=github&utm_medium=social
- Host: GitHub
- URL: https://github.com/curiosum-dev/elixir-macros-metaprogramming
- Owner: curiosum-dev
- Created: 2020-07-01T07:36:02.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-01T07:57:17.000Z (almost 6 years ago)
- Last Synced: 2025-08-24T10:56:28.264Z (10 months ago)
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a companion repository for the ["Elixir Trickery: Using Macros and Metaprogramming Without Superpowers"](https://curiosum.dev/blog/elixir-trickery-using-macros-metaprogramming?utm_source=github&utm_medium=social) article published at [curiosum.dev](https://curiosum.dev).
## Outline
1. The axioms to keep in mind: The truth about the nature of code, macros and functions in Elixir that you need to realize before reasoning about metaprogramming.
2. Metaprogramming at its core: code that generates code: The core difference between how Elixir understands metaprogramming and how it works in many popular languages.
3. AST: Tree representation of code: The internal representation of code in Elixir and how it can be manipulated and accessed.
4. Macros as functions manipulating ASTs: On the nature of Elixir macros which are little more than a tool to transform abstract syntax trees, with some syntactic sugar to make it feel more natural.
5. The way to understand `quote` and `unquote`: Explaining how quoting and unquoting to code is like interpolation to strings.
6. Wrapping up: Which approach to use when creating macros?: Why and when to use either macro creation strategy described in the article.