Philosophy of Scala macros
summary
Explains that def macros in Scala 2.10 actually expand method calls at compile time, powering concrete features like async/await, the f string interpolator and automatic pickler generation via implicits; shows that a separate repo macro paradise compiler plugin prototypes untyped/type macros and macro annotations, how the Scala typechecker blocks some expansions, and how blackbox macros preserve signatures while whitebox macros can generate visible definitions (enumeration example) and provoke semantic surprises.
AI-written summary · about
chapters (31)
- 0:00Intro
- 1:06Inception
- 4:39Related language features
- 7:09Towards macros in Scala 2.10
- 8:41Macros as implemented in 2.10
- 11:23On the verge of the release
- 11:56Adoption
- 12:49Recognition
- 13:25The main question of today's talk
- 13:48Features represented with method calls
- 14:18Our experience
- 14:52Empowered method calls
- 16:42Empowered interpolation
- 20:07Empowered implicits
- 22:06Example #3 - Before macros
- 22:45Example #3 - Vanilla macros
- 23:47Example #3 - Implicit macros
- 25:32Implicits and macros: a match made in heaven
- 26:19Implicits and macros: a retrospective
- 27:02Summary
- 27:50Limitations of def macros
- 28:25Limitation #2 - Can't affect global bindings
- 29:20Macro paradise
- 30:07Untyped macros
- 30:33Type macros
- 31:04Macro annotations
- 31:59Two faces of Scala macros
- 32:48The phenomenon of whitebox macros
- 33:35Explanation #1 - Scala is not very whitebox
- 34:18Explanation #2 - Whitebox is not very Scala
- 37:36The bottom line








