"$a cmp $b" has always been define as sign($a - $b), so the above numerification are correct. Thnk of them as describing the sequence ($a, $b). if the sequence is increasing then "$a, cmp $b" returns Order::Increase or -1.
Mark Biggar
--
Mark Biggar
ma...@biggar.org
mark.a...@comcast.net
mbi...@paypal.com
Maybe you could view it either way, although I think going the other
way around would make more sense only if the names were Order::Lower,
::Same, ::Higher.
S03 matches the old cmp semantics in that "3<=>4" returns -1, which
represents increasing order because reading left-to-right, we go from
3 up to 4.
However, what I'm wondering is whether Order::Same is "but true" and
the others "but false"? (Which makes cmp in boolean context the same
as eqv, but it seems to make sense that way.)
-David
We should not be encouraging people to use cmp to mean eq. All that will
do is result in Great Confusion.
Larry
Larry
> However, what I'm wondering is whether Order::Same is "but true" and
> the others "but false"? (Which makes cmp in boolean context the same
> as eqv, but it seems to make sense that way.)
OTOH, C programmers can as well assume 'cmp' being an equivalent of '! eqv' in
boolean context; after all that's how strcmp() works... The same goes for
assembly programmers.
(* goes back lurking *)
--
Alexey A. Kiritchun