C++ can do that. You can use a template class that has integer parameters indicating the power of kilogram, meter and second. All the class does is wrap a floating-point number. Now define operators that deal with types appropriately.
Bacterius, on 23 May 2013 - 06:12, said:Now I want to see a language that associates units with variables and intelligently checks that they remain valid throughout statements
rnlf, on 23 May 2013 - 04:04, said:
Ada does this. It's a nice safety rope but it can also get quite messy. Velocity equals acceleration times time? Nope, not without converting everything to a common base type. It is nice to know that you cannot mix different types by accident, but it also means you cannot mix them intentionally without writing more code.
Or you can use Boost.Units.
EDIT: Fixed the link. This editor and I don't get along...