On 8/24/06, Paul Lutus <nospam / nosite.zzz> wrote:
> Calamitas wrote:
>
> > I've not addressed the temperature problem as I'm still not very happy
> > with it. My current opinion is that maybe temperature conversion
> > should be done by separate methods, and only Kelvin should be allowed
> > in the whole units machinery.
>
> If you only have Kelvin and no other temperature units, no conversions can
> be made.
>
> > As Kelvin has the absolute zero
> > temperature as reference point, there are no problems in its use.
>
> Rankine also has absolute zero as its reference point. Rankine = Kelvin *
> 1.8.
>
> > Besides, we were taught in science class to first convert all
> > temperatures to Kelvin, then do all calculations, and then convert
> > temperatures back if necessary, so this restriction should pose few
> > problems (for me at least).
>
> Except, unless I have misunderstood you, you won't have any other
> temperature units.

I think that you may indeed have misunderstood. What I meant is that
I'd allow all temperature units in explicit conversion (using #to, or
possibly some extra methods), but not in other manipulatons of
quantities (+, *, etc) where only Kelvin would be allowed, and
possibly Rankine too.

As the library works now, quantities like 1 m/s can be converted to
other units by explicit request from the programmer or implicitly when
adding/subtracting/comparing two quantities. You cannot do this with
absolute temperatures, because that would lead to things like:

  2 K / 2s = - 271.15 C / 2s = -135.575 C/s
  = 1 K / s = -272.15 C/s

So absolute temperatures can only be converted if not combined with
another unit. Note that it does make sense to combine absolute
temperatures with other units as quite some physical equations involve
absolute temperatures (for instance the ideal gas law), though only
when using Kelvins.

So to keep things simple, I'd only allow conversions between
temperatures by themselves (both absolute and differential), and only
allow Kelvin/Rankine in other operations. I could allow Fahrenheit and
Celsius as well, with the understanding that they have to be
differentials, or be relative to absolute zero. However, this adds
some extra conceptual complexity, and remembering from science class
that conversion of all temperatures to Kelvin (or Rankine) is good
practice, it seems better to just disallow Fahrenheit and Celsius from
anything but simple temperature conversions. As this would make those
two a major special case, they wouldn't fit into the existing
machinery, and I'm still contemplating whether or not to integrate it
into this machinery, or to keep it separate.

I hope this makes clear what I meant, and why.

Peter