Programming Languages with Units?

Every now and then I've thought it would be cool if one could specify the variable type in a programming language not as something like and integer or a floating point value, but as a distance, time interval, or voltage.

For the most part it wouldn't be all that difficult. There are only a handful of fundamental units from which all others can be derived (those are mass, distance, time, and depending on who you're talking to, temperature and electric charge).

After some painstaking research (well, skimming the first page of google results) turns up only the Fortress Project as one that's considering including this feature. Maybe something like OCaml could do the trick with an add-on library?


At 11:59 AM, Blogger Paul said...

Mathematica has this ability, as far as I remember... And I constantly keep Qalculate! window open on my desktop (I know, it was not what you were asking for)...

Paul B.


Post a Comment

<< Home