Through Mirrors, you can inspect data structures, such as case classes and enums.
This includes expanding inline def method definitions, simplifying inline if and inline match expressions, or performing inline summon (looking up given/ implicit values). The inline modifier instructs the compiler to evaluate the code at compile-time. Scala 3 offers two basic metaprogramming modes: inlines or macros. The first question to consider is: Do I have to write a macro in the first place? Below, you can find some of the things that we’ve learned along the way. We’ve ported a number of macros from Scala 2 to Scala 3: in quicklens, with Kacper Korban in tapir, with Mateusz Borek and more work is waiting with macwire. As with every API, it takes getting used to Scala’s compile-time reflection capabilities are no exception.
Scala 3 offers a brand new metaprogramming experience with a brand new API.