From: Jan Langer (jan_at_[hidden])
Date: 2004-01-09 14:40:38
Dan W. wrote:
>> This absolute vs. relative quantity issues arises pretty much
>> everywhere. For example,
>> if I have two points along the x-axis, one at 7 meters and another at
>> 12 meters, what does
>> it mean to add the two? Nothing really. We can add an increment in
>> distance to either one,
>> to get a new absolute position or we could add two increments to get
>> another increment, but
>> adding two absolute quantities doesn't really make sense. In the
>> same way, if I write
>> 32*_fahrenheit+32*_fahrenheit = 64*_fahrenheit
>> it makes perfect sense if one or both of the terms on the left is a
>> relative quantity, but not
>> if both are absolutes...
> That's right. I'd define a Farenheit_diff such that
> Farenheit + Farenheit_diff -> Farenheit; ok
> Farenheit + Farenheit -> ERROR;
> Farenheit_diff + Farenheit_diff -> Farenheit_diff; ok
> Same thing goes for Date and days_diff, point3d and vector3d, etc.
i disagree. i think this issue is not so much related to unit or
dimensional analysis in the first place. it is possible with each and
every unit. i think it would lead to a much more complicated design.
most people wont need it. but i think it could be dealt with by means of
an appropriate value type. this might also be useful in other scenarios.
the same goes imho for non-linear scales like dB and so on.
> So, it would be unwise to allow addition of apples and apples by
> default... :)
i dont understand this.
-- jan langer ... jan_at_[hidden] "pi ist genau drei"
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk