Brian Clapper discusses Contextual


Long-time Scala heavy lifter Jon Pretty gave a talk about his Contextual library (, at the Northeast Scala Symposium unconference. The library allows you to write string interpolators, like s”This is a message: x=$x”, while retaining compile time checks.

It’s easy to write a string interpolator. But, normally, to write one and have compile-time checking, you need to delve into macros. Contextual hides the macros and exposes a much simpler interface for managing those checks.

Contextual is, in many ways, an ideal library: It takes something complex, hides the ugly, and exposes something easier to use.

Since we’re unlikely to entice Jon to come talk to PHASE—he lives and works in London—Brian will take a stab at it.

This talk will focus on using Contextual, rather than on Contextual's implementation. It will be light on lecture and heavy on code, reviewing some of Jon's usage examples, as well as attempting to live-code our own. Bring your ideas!

Thanks to Chariot Solutions for volunteering their facilities for this event.