useragent icon indicating copy to clipboard operation
useragent copied to clipboard

Why <=> returns false for invalid comparison?

Open FranklinYu opened this issue 9 years ago • 2 comments

If <=> returns nil for invalid comparison, we can reuse the standard Comparable module, which has been available since at least 1.9.3. Any use case for that? I think most people would just use other derived operators, instead of directly use <=>.

FranklinYu avatar Aug 28 '16 23:08 FranklinYu

It looks like the custom Comparable module comes from the first commit so I'm not sure why it's done that way.

Changing it for a nil returning implementation breaks several specifications so it's not a simple fix but I think it is a good idea to explore.

gshutler avatar Aug 30 '16 13:08 gshutler

Yes, it is not expected to be a simple fix. I think it may even break backward compatibility (if anyone is really using this operator). Hard choice.

FranklinYu avatar Aug 30 '16 17:08 FranklinYu