On to Hydro
Mark S. Miller
Fri, 18 Aug 2000 00:09:08 -0700
At 01:06 PM 8/17/00 , Tyler Close wrote:
>you'll have to upgrade the "<" operator to at least strict weak
>ordering, though I'll push for total ordering.
>I think the solution might be that we don't provide any 'automatic'
>comparison operators, and just map them all into method names.
>Operator Method Ordering
>-------- ------ ---------
> < before total or strict weak
> <= within partial
> > after total or strict weak
> >= includes partial
Are you proposing that "<" and ">" be defined in terms of one order while
"<=" and ">=" be defined in terms of a different one? In you proposal,
would the following equations no longer hold:
(a < b) == ((a <= b) && !(a >= b))
(a <= b) == ((a < b) || (a >= b))
(Note: these two may be equivalent, so only one may be needed.)
If these equations no longer hold, I'm freaked out. I think my programmers
would be too.
As to total vs strict weak; if I understand the definitions correctly, it is
equivalent to asking whether we can dispense with "<=>" and just use "=="
instead. I hate to use IEEE floating point again, but what about -0.0? In E,
? -0.0 == 0.0
# value: false
? -0.0 <=> 0.0
# value: true
0.0 and -0.0 denote the same real number, and so are numerically equivalent.
But they are not computationally equivalent. In E terminology, the are "as
big" or "the same magnitude", but they are not "the same". Historical note:
I hated introducing "<=>", but I saw no alternative.