Tuesday, September 16, 2008

Andrew Kennedy's Blog : Units of Measure in F#: Part One, Introducing Units

Why doesn’t the US use the metric system?  That year, Congress went on summer vacation before the bill was supposed to be passed….

Measure conversion has caused numerous (and disastrous problems).  Think of litres to gallons conversion in an airplane, and really quickly you see how someone could run out of gas if they aren’t using the correct units of measure.

MS is trying to fix this with typed unit recognition in programming languages.

As recently announced in the September 2008 F# CTP (Community Technical Preview), the F# programming language now has full support for static checking and inference of units-of-measure. In this series of articles I'll gently introduce the feature. (If you're not familiar with F#, look here.) We've already been testing out the units-of-measure feature inside Microsoft and I'm amazed at the diversity of applications that are turning up. Of course, there are the obvious applications to scientific computing, and games (which are all about physics, after all), but we're seeing applications in machine learning, finance, search (think click rates, etc) and others.

Andrew Kennedy's Blog : Units of Measure in F#: Part One, Introducing Units

No comments: