Re: Numerification of Order:: constants
On Thursday 17 August 2006 21:27, David Green wrote: 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
Numerification of Order:: constants
S03, lines 418-420: [cmp] always returns COrder::Increase, COrder::Same, or COrder::Decrease (which numerify to -1, 0, or +1). Shouldn't Order::Increase numerify to +1 and Order::Decrease to -1? In which case it would be clearer to put them in respective order above...
Re: Numerification of Order:: constants
-- Original message -- From: Reed, Mark (TBS) [EMAIL PROTECTED] S03, lines 418-420: [cmp] always returns COrder::Increase, COrder::Same, or COrder::Decrease (which numerify to -1, 0, or +1). Shouldn't Order::Increase numerify to +1 and Order::Decrease to -1? In which case it would be clearer to put them in respective order above... $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 [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]
Re: Numerification of Order:: constants
On 8/17/06, Reed, Mark (TBS) wrote: S03, lines 418-420: [cmp] always returns COrder::Increase, COrder::Same, or COrder::Decrease (which numerify to -1, 0, or +1). Shouldn't Order::Increase numerify to +1 and Order::Decrease to -1? In which case it would be clearer to put them in respective order above... 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
Re: Numerification of Order:: constants
On Thu, Aug 17, 2006 at 11:27:21AM -0600, David Green wrote: : 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.) We should not be encouraging people to use cmp to mean eq. All that will do is result in Great Confusion. Larry
Re: Numerification of Order:: constants
I don't know if I've made this clear, but over the last few years I've been treating but True and but False as design smells. They're fine as a workaround for dire circumstances and uncooperative types, but you'll not find me designing very many of the core interfaces to use them, or other run-time mixins, for that matter. Solutions involving but will generally be rejected, in other words. Larry