
Boost : 
From: David Richardson (dgr24_at_[hidden])
Date: 20031015 14:03:09
David Abrahams wrote:
> David Richardson wrote:
>
>> Deane Yang wrote:
>>
>>> c) Automatic generation of new types when two different quantities
>>> are multiplied or divided
>>
>> I'm a bit confused how this would work (maybe because I've been
>> thinking about this as a physics problem). Do we just pick an
>> arbtrary rule for the production of new types/units?
>
>
> No, mathematics gives the rules. You can see examples in my slides at
> http://www.boostconsulting.com/writing/ACCU_MPL_slides.ppt
The slides have examples where the units are from physics. So you
represent a number's units as a ntuple of exponents with each
exponent corresponding to one of the fundamental SI units.
Arithmetic operations on numbers with these units have well
defined rules to compute the resulting units.
If the semantics of the exponents in the ntuple are user defined,
it is not clear to me what rules to use to derive units. I've
never used units outside of some kind of physical situation.
Is the notion of units where the semantics of the exponents are
user defined, but the arithmetic rules are the same as they are
for physical units useful to other fields? Do these rules cover
all cases, or are the other fields that would want different rules
for deriving the resulting units of an arithmetic expression.
Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk