Scala.meta at ScalaDays 2014

Eugene Burmako

Scala 2.10 was the first language release that provided a public native API for metaprogramming Scala, introducing facilities for compile-time (macros) and runtime (Java-like reflection) metaprogramming. These facilities have brought a lot of feedback, and we've been thinking hard how to make sense of it.

It has become clear that dedicated support for metaprogramming is useful. Previously, one had to deal with ad-hoc solutions like textual code generation and command-line scalap invocations. However, since Scala 2.10 there is a full-fledged model of Scala that accounts for the variety of language constructs and includes a comprehensive, backward-compatible API. Nevertheless, there's still quite some work to be done in order to make our metaprogramming tools enjoyable. The main issues that remain to be addressed are verbosity and brittleness of the underlying API, difficulties with tool integration, tight coupling with scalac, and potential for confusion caused by leaking implementation details and cryptic error messages.

The goal of scala.meta is to make metaprogramming easy, ensuring that it doesn't require knowledge of compiler internals, is safe by construction and is portable across a wide range of implementors. Towards that end, we have rethought the metaprogramming APIs along with the accompanying macro engine, keeping existing functionality in place and at the same time fixing fundamental problems intrinsic to the original implementation.

At the moment of writing (17 June 2014), the project has already been going on for a few months, but no publicly usable code is available just yet. We plan to release a technology preview this fall, and that's also when it will become clearer whether and how scala.meta is going to be integrated into future versions of Scala. Stay tuned!

First announcement: Rethinking Scala Macros New York, Mar 2014 (slides, no video available)
Latest presentation: State of the Meta, Summer 2015 Amsterdam, Jun 2015 (click here for the video)
Latest workshop: Hands on Scala.Meta Penrith, Sep 2015