. .

smalltalk

Quantities in VisualWorks

June 7, 2011 19:00:00.000

Michael Lucas-Smith has a detailed write up on a new Quantities library he's created in VisualWorks. It's taken inspiration from part of the Boost library - you can get details at the link. What's the motivation?

So with these two great examples of units and quantities to go off of, I set about trying different variations for describing quantities in VisualWorks generically. I wanted to allow it to blend with the existing (and future) implementation of Duration. I *really* wanted to know if there is any design impact on Duration that I need to know about now before I go and change its implementation in VisualWorks 7.9.

After going through many iterations, I ended up with a design using the same trick as Measurements, but with more capabilities, such as instantiating Duration when dealing with the Time dimension. Or instantiating an Angle when you’re dealing with radians, degrees and gradians. There is of course the Temperature class too - but I won’t bore you with the details of that one

posted by James Robertson

 Share Tweet This