Description
In this course, you will :
- Learn the fundamentals of metaprogramming in Elixir.
- Discover the meaning of macros and the abstract syntax tree.
- Create a Domain-Specific Language in HTML
- Learn how to properly test meta-programming code.
Syllabus :
1. The Language of Macros
- Introduction to Metaprogramming
- Tying AST and Macros Together
- The Abstract Syntax Tree
- Macros: The Building Blocks
- Code Injection and the Caller’s Context
2. Extending Elixir with Metaprogramming
- Custom Language Constructs
- Smarter Testing with Macros
- Leveraging the Virtual Machine’s Pattern Matching Engine
- Extending Modules
- Using Module Attributes for Code Generation
- Compile-Time Hooks
3. Advanced Compile-Time Code Generation
- Generating Functions from External data
- MIME-Type Conversion
- Building an Internationalization Library
- Finalize Building Our Internationalization Library
- The Complete Translator Module
- Introduction to Macro.escape
- Code Generation from Remote APIs
4. How to Test Macros
- Setting Up Your Test Suite
- Deciding What to Test
- Integration Testing
- Unit Tests
5. Create an HTML Domain-Specific Language
- Getting Domain Specific
- Defining Minimum Viable API
- Keeping State With Elixir Agents
- Supporting the Entire HTML Spec with Macros
- Enhancing API with HTML Attribute Support
- Generating Less Code by Walking the AST
- To DSL or Not to DSL?
6. With Great Power Comes Great Responsibility (and Fun!)
- When and Where to Use Macros
- Avoiding Common Pitfalls
- Kernel.SpecialForms: Know the Environment and Limitations
- Bending the Rules
- Build the Future!