State of the meta, fall 2015

Eugene Burmako

Hello everyone! Today's issue of state of the meta will provide an update on our progress with 0.1, explain the areas of applicability of the recently released 0.0.4 and give you some code examples to play with.

Hands on scala.meta

My recent workshop snapshots our work towards 0.1 during the summer. The repository linked above contains practical guides to using various aspects of scala.meta.

The view-bounds guide features a tool that can automatically rewrite view bounds to their desugarings without losing formatting details and comments. Thanks to scala.meta's principled AST model, it is possible to express such a transformation in a couple dozen lines of robust high-level code, which is a significant improvement over the state of the art that typically involves manual tokenization and string manipulations.

The exploring-semantics guide demonstrates our progress with serialization of typed abstract syntax trees. With scala.meta, it becomes possible to save comprehensive information about your programs into .class files and then load it for inspection later on. Semantic APIs that enable this functionality are much less stable than syntactic APIs that power code rewritings, but you can still take a look to get an idea where it's all going.

New features in 0.0.4

This summer was time of intense hacking! During his Google Summer of Code project, Oleksandr Olgashko (@dveim) went through the entire quasiquote spec, implementing missing functionality, fixing broken aspects of the parser and writing tests, a whole bunch of them. Thanks to Oleksandr, the upcoming 0.1 is unexpectedly going to support quasiquotes, and you can already see with the results of his work in 0.0.4. Check out the view-bounds guide for concrete examples.

In the meanwhile, I was working on AST persistence and have found a groundbreaking flaw in our previous semantic model. Devising ways to fix this flaw has led to significant changes in scalameta and almost a complete rewrite of scalahost, which took me a couple months. Our new semantic model is documented in and illustrated in the advanced-dendrology guide. This is not going to be an easy reading, so you might want to skip it if you're not interested in internals of scala.meta.

Finally, the project has undergone noticeable restructuring. I removed repositories with obsolete experiments, merged everything relevant into a single super-repository (thanks to the advice of Guillaume Massé) and split the previously monolithic scalameta.jar into about a dozen loosely coupled modules. See code examples in the aforementioned guides to see how to see how things are done in 0.0.4. If this sounds scary, don't worry - most of the publicly visible changes affect the semantic API, but syntactic functionality should work as in 0.0.3.

What next?

Next, we'll work on issues scheduled for 0.1 and release 0.1 once that list of issues is exhausted. You can always check what exactly is being done at the moment via the "In progress" list and come ask me anything at