This doc page is specific to features shipped in Scala 2, which have either been removed in Scala 3 or replaced by an alternative. Unless otherwise stated, all the code examples in this page assume you are using Scala 2.


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: