Skip to main content

Posts

Showing posts from September, 2009

F# and Units of Measure

On Channel 9 they have an interview with Andrew Kennedy about the new Unit of Measure feature in F#. This is a really cool feature and I have plans to use it, however there is one problem I have with it: The UOM information is baked into the compiler and can't be persisted. An example that Andrew uses it the NASA's Mars Climate Orbiter that crashed due to an issue with Units of Measure (long story short the program thought it was using Newtons when it was actually using Pounds Force). This is a good example of how when you are doing calculations it would be nice if something other than the brain of the programmer was checking the units. But there is another time that UOM is important: When inputting the data. I recently worked on an application where the units for a given value could be in English or SI (metric) units and we had an elaborate system to deal with them. The end user could even come up with their own unit system if they wanted to and the application had to