From: Paul Brannan Date: 2002-05-18T05:50:56+09:00 Subject: Exceptions and <=> I was playing with <=> recently, and I noticed that the following: class Foo def ==(other) raise "uh oh" end end p Foo.new == 42 prints (on Ruby 1.6 and 1.7): -:3:in `==': uh oh (RuntimeError) from -:6 However: class Foo include Comparable def <=>(other) raise "uh oh" end end p Foo.new == 42 prints: false While this makes sense (if <=> raises an exception, then the two values probably weren't equal), it is inconsistent. If an exception gets propogated in one case, it should be propogated in another case. I think it would be preferable for <=> to always propogate the exception, since some exceptions (ArgumentError, NameError, etc.) often indicate bugs, and catching them prevents unit tests from catching potential problems. Any thoughts? Paul