From: David Richardson (dgr24_at_[hidden])
Date: 2003-10-15 10:27:39
Were cases other then addition considered? It seems like this
would not work for multiplication unless the user was also allowed
to specify a rule of the resulting unit of a multiplication of a
user tagged variable.
In your example, what are the units of squaring a gallon tagged
How often do problems like this come up? Is it better to just let
people with such problems make their own class that uses the unit
library for the gallon part and implements the additional logic in
the new class?
Beman Dawes wrote:
> In prior discussions of units-of-measure problems, it was pointed out
> that in many applications it might be necessary to tag types with more
> than just simple units-of-measure like gallons or liters.
> For example, if x and y are variables representing gallons, it still may
> not be valid to add them together. (Consider that x may be gallons of
> unleaded regular gasoline, while y may be gallons of propane.)
> Even if x and y both represent gallons of propane, there can still be
> problems: to do addition correctly, you must either know that the
> gallons are temperature compensated or know the temperature of each.
> (Propane's coefficient of expansion is high enough that by US law
> commercial measurements must be temperature compensated.)
> IIRC, prior discussions leaned toward solving such problems by allowing
> for user supplied units-of-measure. That would allow industry specific
> problems like the above examples to be solved without requiring the
> library to know about every unit-of-measure need in the world.
> Unsubscribe & other changes: