Macros

Roadmap

Language
This doc page is specific to features shipped in Scala 2, which have either been removed in Scala 3 or replaced by an alternative.

EXPERIMENTAL

The functionality and APIs provided by Scala macros has remained mostly unchanged since 2.11. There are no plans to extend current def macros with new functionality. There is ongoing work to develop a macro system for Dotty, which is planned to be released as Scala 3 by early 2020. Read the announcement of Scala 3 here.

If you need to write macros today, it is recommended to use the def macros that are documented here and are included with the Scala compiler. Widely used libraries like ScalaTest, sbt and Play Framework use def macros even if they are still labeled as experimental.

Contributors to this page: