Metaprogramming may feel daunting at first. We're doing a lot even before compilation starts, and the errors and warnings we get may seem cryptic sometimes. Having a clear end goal on your mind, and performing small iterations, will allow you to get comfortable with the quote/2 and unquote/1 dance and let you accomplish some neat macro-based features.
What follows is a brief compilation of the main concepts and tools we applied, which you can now incorporate in your tool belt:
- The abstract syntax tree of any expression, also called a quoted representation, is a nested structure of three element tuples that the compiler knows how to convert into BEAM bytecode. You can get this quoted representation by using the quote/2 ...