Are units of measurement unique to F#?

f#, functional-programming, programming-languages

Solution

Does TI-89 BASIC count? Enter `54_kg * (_c^2)` and it will give you an answer in joules.

Other than that, I can't recall any languages that have it built in, but any language with decent OO should make it simple to roll your own. Which means someone else probably already did.

Google confirms. For example, here's one in Python. `__repr__` could easily be amended to also select the most appropriate derived unit, etc.

CPAN has several modules for Perl: Physics::Unit, Data::Dimensions, Class::Measure, Math::Units::PhysicalValue, and a handful of others that will convert but don't really combine values with units.

Problem

I was reading Andrew Kennedy's blog post series on units of measurement in F# and it makes a lot of sense in a lot of cases. Are there any other languages that have such a system? Edit: To be more clear, I mean the flexible units of measurement system where you can define your own arbitrarily.

Original source