Monday, December 10, 2012
Scala course at Chalmers
During the past week Adam has attended an intensive Scala course at Chalmers, brilliantly presented by David Raymond Christiansen of ITU. The course introduced several aspects of advanced Scala programming, focusing on how its type system can be used with various approaches to embedding DSLs in Scala. Particular weight was given to Scala's implicit conversions mechanism, which e.g. makes it possible to emulate Haskell's type classes (with some additional flexibility) in Scala and can make interoperation with Java libraries smoother. The material of the course built up to the topic covered during the last day, a technique and framework called Lightweight Modular Staging (LMS). Adam found it easier to grasp after having understood the polymorphic DSL embedding technique, covered earlier in the week, of which LMS is an instance. In brief, this technique is based on defining the DSL as operations on an abstract data type. A program in the DSL is a nested call to these operations, and interpreters for the DSL are defined as implementations of the abstract operations which make up the program.