Remember the $125 million dollar mistake where a failure to convert English units into metric units caused the Mars probe to fly off course? Wouldn’t it be cool if you software program had the units of measure built into the code? I’m not sure if it would have prevented the Mars probe mistake, but it may make your next application more robust. A feature of F#, called Units of Measure, allows your code to include inches or kilograms or some unit of measurement unique to your business logic or scienteific domain. It can provide intellisence and other development time feedback in error messages or unit tests.
S. Somasegar, Senior Vice President, Developer Division at Microsoft, recently blogged on the subject.
Check out some of these references for more on the subject:
- Units of Measure in F#: Part One, Introducing Units – Andrew Kennedy
- Units of Measure in F#: Part Two, Unit Conversions – Andrew Kennedy
- Units of Measure in F#: Part Three, Generic Units – Andrew Kennedy
- Units of Measure in F#: Part Four, Parameterized Types – Andrew Kennedy
- MSDN F# Documentation of Units of Measure – Microsoft
- Modeling DSLs with F# and Units of Measure – Matthew Podwysocki
- F# in VS2010 – S. Somasegar