Don't miss this London Scala meetup with talks from Zainab Ali and Jon Pretty.
Interpolated strings, like the familiar `s""`, provide a convenient way to embed external DSLs in Scala source, allowing you to construct a new value at runtime from a string literal, with Scala expressions substituted within it. But unless you are prepared to implement the interpolator using a macro, the compiler offers no checks on the correctness or well-formedness of the embedded DSL. Contextual is a small open-source library which does the heavy lifting work to make it trivial to write interpolators to check DSLs which at compile time, without requiring any complicated macro code. An interpolator which parses a DSL when Scalac runs -- with its own custom error messages -- can be written with Contextual in just a few lines of ordinary user code, calling upon parsers, regular expressions or any other means to check the interpolated string and report custom errors at the exact position. This opens up a wealth of possibilities for adding more compile-time safety to Scala code, not least the ability to introduce your own literal-like types, ranging from checked email addresses or URLs to compile-time-parsed URLs, CSS, SQL or even Haskell!
Jon has been having fun riding the bleeding edge of Scala for over a decade, and he's not finished yet. While he's not travelling the world attending Scala conferences, or organizing Scala World, Jon spends his time working on a variety of open-source Scala libraries, and providing professional Scala training services.
When we code, we code in numerics - doubles, floats and ints. But those numerics always represent real world quantities. In other words, each problem domain has it's own kinds of quantities, with their own dimensions. In this talk, we'll tackle dimensional analysis in the field of basic rocket physics. We'll explore dependent types, and dive into generic programming along the way. We'll find that dimensional analysis can be brought much closer to home - in the compilation stage itself! And finally, we'll end up creating Libra - a library which brings dimensional analysis to any problem domain.
Zainab is a functional programmer. She is the author of Libra and a contributor to many functional Scala libraries, such as cats and fs2.