This doc page is specific to Scala 3, and may cover new concepts not available in Scala 2. Unless otherwise stated, all the code examples in this page assume you are using Scala 3.
This tutorial covers all the features involved in writing macros in Scala 3.
The metaprogramming API of Scala 3 is designed in layers to gradually support different levels of use-cases. Each successive layer exposes additional abstractions and offers more fine-grained control.
As a starting point, the new
inlinefeature allows some abstractions (values and methods) to be marked as statically reducible. It provides the entry point for macros and other metaprogramming utilities.
Compile-time operations offer additional metaprogramming utilities that can be used within
inlinemethods (for example to improve error reporting), without having to define a macro.
inlinemethods, macros are programs that explicitly operate on programs.
The tutorial uses the API of Scala 3.0.0-RC3. The API had many small changes in this revision.
🚧 We are still in the process of writing the tutorial. You can help us 🚧