Applied Materialization: When Macros Meet Implicits (Bay Area, June 13) - Excelsior
May. 30th, 2013
06:37 pm - Applied Materialization: When Macros Meet Implicits (Bay Area, June 13)
A prominent peculiarity of Scala macros is the fact that they are very good at synergizing with the language features and the type system of vanilla Scala. The most impressive example of such a synergy are implicit macros that combine the flexibility of implicits and the code generation power of compile-time metaprogramming without compromising understandability and type safety.
We will start off with a simple serializer and will look into ways of generalizing it without sacrificing performance. That's going to be a good occasion to get acquainted with macros and learn a trick of two from macrology 101. With macros we will be able to match the performance of handcrafted serializers without going through the trouble of actually writing the boilerplate code.
Having familiarized ourselves with macros, we will push the boundaries of conciseness by using materialization, a new technique introduced in Scala 2.10.2. With a couple of materializing macros in place, the amount of code necessary to make a class serializable will be reduced to absolute zero.
Finally we will conclude with the details of interaction between materializers and type inference and how that allowed us to address a couple of challenging theoretical problems. Interestingly enough, this esoteric concept plays an important role in the design of macros 2.0 scheduled for Scala 2.11+.
P.S. Huge thanks to juan_gandhi for organizing the meetup!