February 2018
Intermediate to advanced
278 pages
6h 9m
English
While regular syntactic macros are useful in a number of scenarios, some applications need advanced code generation features that are better done using the AST that the compiler operates on. Thus, there was a need to extend the macro system to include this. It was later decided that the old macro system and this new system called procedural macros would co-exist. Over time, this is intended to replace the syntactic macro system. The compiler supports loading plugins from external crates; these can receive the AST once the compiler has generated it. There are APIs available to modify the AST in-place to add new code as required. A detailed discussion of this system is beyond the scope of this book.
Read now
Unlock full access