After announcing the winners of our Scala Italy competition (if you missed that post check it out here) we are counting down the days until the conference begins! To feed our excitement we have been looking back over the talks from last year, here is a great one from Jon Pretty that we wanted to share with you!
Scala Italy 2017 - Jon Pretty - Contextual: Easy, compile-time string interpolation without macros! from Scala Italy on Vimeo.
'Interpolated strings, like the familiar `s""`, provide a convenient way to embed external DSLs in Scala source, allowing you to construct new runtime values from string literals, with Scala expressions substituted within it. But unless you implement the interpolator using a macro, the compiler provides no checks whether the embedded code is correct or well-formed. Contextual is a small open-source library which does the heavy lifting work to make it trivial to write string interpolators which run at compile time, without requiring any macros. A string interpolator which statically parses and checks a DSL, with its own custom compile errors, can be written with Contextual in just a few lines of very ordinary code, calling upon parsers, regexes or any other means to check the interpolated string, opening a wealth of opportunities for adding compile-time safety embedded DSLs in your code.'
This talk was given by Jon Pretty at Scala Italy 2017.