On Jan 19, 2007, at 3:20 PM, Ed Howland wrote:
> But in terms of Ruby "doing the right thing", you'd expect
> [false, true, false].sort
>    --> [false, false, true]
> because it does this just about everywhere else. This is such a common
> idiom in CS, that I think Ruby should implement it. But then, I only
> have just the 2 cents. Anyone know the main reason it does not?

interesting observation

Since true and false are not instances of the same class it is
like asking how to compare 4 and :foobar or 6.32 and "tuesday".

One possibility would be to have <=> be defined in terms of object_id
by default similar to how == is defined.  Since false.object_id is 0
and true.object_id is 2 that does give you [false,false,true]
in your example but for an obscure, implementation dependent reason.

Gary Wright