Macro paradise 2.0.0-final

Eugene Burmako
21.04.2014

Today we're extremely happy to conclude the first development cycle of paradise and, after nine months of active development, release the final version of Macro Paradise 2.0.0 for Scala 2.10.x and 2.11.0. We would like to heartily thank everyone who's been involved in development, testing and adopting our technologies over these nine months!

What's in there

Delivering on its promise to make latest macro developments widely accessible, paradise 2.0.0 backports quasiquotes from the recently released Scala 2.11.0 in Scala 2.10.x. With macro paradise, you can write your 2.10.x macros using the state of the art in tree construction and deconstruction!

Apart from consolidating macro capabilities of 2.10.x and 2.11.0, macro paradise also implements macro annotations - a unique feature that's yet to make its way into the official Scala distribution. Macro annotations have already proven useful for building type providers, generation of matchers for Specs2, building boilerplate-less, Java-compatible enumerations and implementing first-class delegation, among the multitude of other uses. We are looking forward to seeing what you are going to build with them!

Plans for the future

Our next step in development of macro paradise is transitioning macro annotations into the official Scala distribution. In order for that to work, we plan to to address two existing issues that we have identified while evaluating macro annotations:

  1. Insufficiently good story for macros in general with respect to convenience of the public API and tool support (error messages, incremental compilation, Intellij, Scala IDE, etc)
  2. Seeming unsoundness of c.typecheck in certain situations that can lead to spurious cyclic errors or seeing half-expanded code (one of the manifestations is https://github.com/scalamacros/paradise/issues/14)

The immediate next move is making existing macro flavors (def macros) easier to use and providing first-class support in the tool ecosystem. This will bring us better understanding of how we can make macro annotations not only available, but also enjoyable for everyone. That's something that we've been doing for quite a while in Project Palladium, and we'll report on our progress during the upcoming Scala Days.

Of course, while pursuing high-level goals outlined above, we will also be performing maintenance releases for both 2.10.x and 2.11.x branches, addressing known issues and newly discovered bugs. For example, we've just fixed #42, and the fix will soon be deployed as part of 2.1.0-SNAPSHOT available for all supported versions of Scala.

Migration notes

Finally, some notes for those of you who have been using pre-release versions of paradise. Comparing with 2.0.0-M3, which is by far the most widely used milestone of paradise, the only big change is in quasiquotes in paradise for 2.10.x.

Before 2.0.0-M4, the quasiquote engine in paradise for 2.10.x was using a very old implementation dating back to 2.11.0-M4. In paradise 2.0.0, we've backported all advances in quasiquoting that have been made since then. This brings a lot of improvements, but can also change behavior in some corner cases. A lot of paradise users have already migrated without a hitch, so everything should be fine, but just in case here's the link to the latest quasiquote documentation that's going to come in handy in tough situations: http://docs.scala-lang.org/overviews/macros/quasiquotes.html.

Also, before 2.0.0-M7, the quasiquote support library for Scala 2.10.x was cross-versioned against minor Scala versions (i.e. quasiquotes_2.10.2, quasiquotes_2.10.3 and quasiquotes_2.10.4). Starting from M7, it is binary-compatible across all 2.10.x versions (i.e. there's only quasiquotes_2.10).

Concretely, in order to migrate to 2.0.0 from earlier versions of paradise 2.10.x, you'll need to change your dependency configuration for quasiquotes from using full cross-versioning strategy:

  • OLD "org.scalamacros" % "quasiquotes" % "2.0.0-Mx" % CrossVersion.full, or
  • OLD "org.scalamacros" % "quasiquotes_2.10.x" % "2.0.0-My"

To using binary cross-versioning strategy (which, apart from being more robust with respect to transitive dependencies, also has a nice shorcut in SBT's dependency management DSL):

  • NEW "org.scalamacros" %% "quasiquotes" % "2.0.0"