1

The Scala Macro Paradise is available for 2.11 and 2.10. For 2.10, it says

you can already make use of quasiquotes in production versions of 2.10.x

Does that mean that 2.10 paradise is a subset of the 2.11 version? For instance, can I experiment with type macros, using Scala 2.10, or is that a feature for which I need to work with 2.11?

3 Answers 3

2

Macro paradise have been recently revamped into a compiler plugin. It includes much improved support of quasiquotes (source compatible with 2.11) and macro annotations. Type macros and untyped macros have been discontinued (in favor of macro annotations.)

2

Paradise 2.10.x only includes quasiquotes because of binary compatibility restrictions. Thanks for the excellent question btw. I've updated the guide here.

2

My understanding is that you only get access to quasiquotations. You compile your macro with this special 2.10 version of macro paradise, and can then use them in code that compiles against (normal, non macro paradise) scala 2.10. This is possible because quasiquotations are used when compiling macros themselves, and expand to normal macro code that uses nothing else that APIs available in Scala 2.10 already (creating trees explicitly, node by node). So you can the use those macros in Scala 2.10 code, the compiler won't see the difference.

On the other hand type macros cannot use this trick, because they are not available at all in scala 2.10. Generating types at compile time is not something that the scala 2.10 compiler knows how to do, so you will definitely need to compile your client code (your actual code, as opposed as just the macro code) using a 2.11 compiler.

1
  • Ok, thanks for the clarification. I'll be playing then with 2.11, even if I'll have to wait for its release to be using it across published libs.
    – 0__
    May 25, 2013 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.