Last time, I talked a bit about how you might implement parts of a Units of Measurement system in Scala (stay tuned for the rest of the implementation). Since this is going to be the topic of my Bachelor's thesis, I've made a presentation about Units of Measurement systems in other languages, specifically F#, C++ and Haskell. You can view it right here:
or download a pdf (without the snazzy transitions).
The newest version of Scala, 2.10, will allow to user to execute code at compile time with Macros, which are just normal Scala functions. You can get an overview of the possibilities at the official Scala Macro guide. Right now, Scala 2.10 is still under development, so you will have to use a Release Candidate to follow along.
First of all, a good system of measurements should make it easy to define values with units in code - no complicated trickery should be required. That's easy to achieve with a small utility macro:
val a = u(42, "m/s …