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.
NEW
Eugene Burmako
I have always imagined that paradise will be a kind of library. Jorge Luis Borges, “Poem of the Gifts”
Macro paradise is a plugin for several versions of Scala compilers.
It is designed to reliably work with production releases of scalac
,
making latest macro developments available way before they end up in future versions Scala.
Refer to the roadmap for the list of supported features and versions
and visit the paradise announcement
to learn more about our support guarantees.
~/210x $ scalac -Xplugin:paradise_*.jar -Xshow-phases
phase name id description
---------- -- -----------
parser 1 parse source into ASTs, perform simple desugaring
macroparadise 2 let our powers combine
namer 3 resolve names, attach symbols to trees in paradise
packageobjects 4 load package objects in paradise
typer 5 the meat and potatoes: type the trees in paradise
...
Some features in macro paradise bring a compile-time dependency on the macro paradise plugin, some features do not, however none of those features need macro paradise at runtime. Proceed to the feature list document for more information.
Consult https://github.com/scalamacros/sbt-example-paradise for an end-to-end example, but in a nutshell working with macro paradise is as easy as adding the following two lines to your build (granted you’ve already set up sbt to use macros).
resolvers += Resolver.sonatypeRepo("releases")
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
To use macro paradise in Maven follow the instructions provided at Stack Overflow on the page “Enabling the macro-paradise Scala compiler plugin in Maven projects” (also make sure to add the dependency on the Sonatype snapshots repository and scala-reflect.jar
).
<compilerPlugins>
<compilerPlugin>
<groupId>org.scalamacros</groupId>
<artifactId>paradise_<YOUR.SCALA.VERSION></artifactId>
<version>2.1.0</version>
</compilerPlugin>
</compilerPlugins>
Sources of macro paradise are available at https://github.com/scalamacros/paradise. There are branches that support the latest 2.10.x release, the latest 2.11.x release, snapshots of 2.10.x, 2.11.x and 2.12.x, as well as Scala virtualized.