[Ironruby-core] Range#=== operator

John Messerly jomes at microsoft.com
Thu Nov 8 16:59:14 EST 2007


John Messerly wrote:

> Peter, I think the right fix here is for Fixnum <=> to return nil if it
> gets passed a non-comparable object. That seems to be the standard MRI
> behavior for <=>:
>
> irb(main):013:0> (1..5) === 'x'
> => false
>

Oops, my example is wrong, it should be:

irb(main):001:0> 1 <=> 'x'
=> nil

IronRuby:
>>> 1 <=> 'x'
System.ArgumentException: wrong number or type of arguments for `<=>'

So we definitely need another overload for Fixnum#<=>, and possibly other places as well that implement <=>.

- John



More information about the Ironruby-core mailing list