On Sun, Jul 08, 2001 at 04:31:20PM +0900, Aleksei Guzev wrote:

> And what about types for meters, miles, feets etc. Automatic convertion
> while assignment whould be useful. But language should support constants
> of that type. Maybe use letters after digits: 10mm, 15cm, 5,8miles,
> 4.45kg, 35%.
> 
> Raising exceptions on trying to add some kilograms to some miles would
> protect user of a lot of algorithmical mistakes.

I think types like these belong in extension libraries, rather than in
the standard language. Sure, they might be convenient in some situations,
but adding them to the basic types would complicate the langauge. It is
important to keep the core language as simple as possible.

Implementation is not completely trivial, for example you would want
6 m / 2 s to give 3 m/s. The best is perhaps to create a class SiValue
that stores the number and the power of each SI unit, so 3 m/s would
be represented by

    x.value = 3
    x.m = 1
    x.s = -1

// Niklas