Macros for the Rest of Us

Written by Dave Gurnell

I’m excited to announce I will be giving a talk at ScalaDays 2014 entitled Macros for the Rest of Us. It will be a layman’s introduction to Scala Macros, jam packed with examples of how they can be useful!

Updated 11th July: The video is up on Parleys and embedded after the break.

Macros are a powerful feature of Scala 2.10 that have received significant updates in Scala 2.11. For the journeyman Scala programmer, however, they can be difficult to approach. There is a scarcity of detailed documentation on important concepts such as AST creation, type inspection, and debugging, that can make your first non-trivial macro a daunting prospect.

In this talk, Dave Gurnell will approach Scala 2.11’s macros from the point of view of the journeyman programmer. He will walk through the creation of a simple macro-based library for data validation, highlighting hints, tips, and best practices that will dramatically lower the barrier to entry into the world of macros. Topics covered will include:

  • project setup and separate compilation
  • AST creation
  • quasiquotes
  • type inspection
  • macro debugging