Connecting...

W1siziisimnvbxbpbgvkx3rozw1lx2fzc2v0cy9zawduawz5lxrly2hub2xvz3kvanbnl2jhbm5lci1kzwzhdwx0lmpwzyjdxq

Jon Pretty - Contextual: Easy, compile-time string interpolation without macros! at Scala Italy 2017

W1siziisijiwmtgvmdgvmjkvmdkvndivmdqvotmyl3blegvscy1wag90by0xmdkymi5qcgvnil0swyjwiiwidgh1bwiilci5mdb4otawxhuwmdnlil1d

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!


'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.

‚Äč