Macros ship with the Scala compiler starting from 2.10.0.
To get started:
- Create a dedicated project for your macros, as they must be compiled separately from the rest of the program.
- Reference
scala-reflect.jar
in the macro project. - Use
import scala.language.experimental.macros
in the files where you define macros. - If in doubt, consult the docs.