Strange Loop

2009 - 2023

/

St. Louis, MO

Philosophy of Scala macros

Let's take a journey to the internals of Scala macros!

We will start off in the early days of macros in Scala and the initial design of def macros, which ended up in the production release of Scala 2.10. We will also take a look at the popular use cases and patterns characteristic for our macro system.

Afterwards we are going to learn about macro paradise, a spawning pool for the new ideas, and get acquainted with its inhabitants: type macros, untyped macros, inference macros, jitted macros and macro annotations. Then, in the next act our new friends will try to make it into Scala 2.11, only to be stopped by the keepers of the Scala typechecker.

The narration will culminate when in addition to discovering a threat coming from the new macros, we find out that Scala 2.10 is already infiltrated. After the two forces collide, the next generation of macros in born, having two faces: blackbox macros and whitebox macros.

The next generation of macros brings peace to the macroland, and happiness ensues. But in the meanwhile, far away in macro paradise, macro annotations are getting mature, planning to try their luck in 2.12...

Eugene Burmako

Eugene Burmako

École Polytechnique Fédérale de Lausanne

Being a metaprogramming aficionado, I believe that metaprogramming can be applied to mainstream programming in a safe and disciplined way. Since fall 2011, as a member of the Scala team and Martin Odersky's PhD student, I am realizing this vision in the Scala macros project. Before joining EPFL I was experimenting with metaprogramming for CLR. My projects in this area include Relinq, a bidirectional LINQ to JavaScript transformer, and Conflux, a library that crosscompiles C# into CUDA.