Boost logo

Boost :

From: David Greene (greened_at_[hidden])
Date: 2006-06-08 18:36:40


Phil Richards wrote:
> On 2006-06-08, David Greene <greened_at_[hidden]> wrote:
>
>> Andy Little wrote:
>>
>>>Complain to the SI people. It aint my fault guvnor!
>>
>> But it's your library! Honestly, I think you are too constrained
>> by some paper SI standard. There is nothing at all that says
>> the library must be implemented this way.
>
> The SI standard has been agreed to be implemented worldwide (and
> should already be according to the original intention). Including
> the USA and the UK (both dragging their feet). It isn't just *some*
> standard - it is *the* standard. Of course, the Boost units standard
> might someday supplant it, but, really, I doubt it.

But that doesn't have anything to do with the _implementation_ of
the library. Andy presented this example to justify kg's 0 power:

    mass::kg m(1); // 1 kg == 1000 g
    acceleration::m_div_s2 a(1); // 1 meter per second squared
    force::N f = m * a;

    The value of f should be 1000 Newtons right?

Of course, the value is 1 Newton. But this has nothing at all to
do with kg having a prefix power of 0 or 3. The calculation can
be done when assigning m*a to f. The compiler (though TMP techniques)
knows that m*a is in kg*m/s^2. It knows it's being assigned to a
value of N. It can look up the prefix powers (3 for kg in my
suggestion) and "do the right thing." If that requires some
special cases for conversions like this, it's better than forcing
everyone who extends the system to keep track of which quantities
follow the rules and which don't.

And besides, as others have argued, a Boost units library needs to
go beyond S.I. S.I. is far too narrow for many domains.

                             -Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk