"Paul Brannan" <pbrannan / atdesk.com> wrote in
....
>
> 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?

I think you make valid point - however catching the exception in
Comparable#==,#< etc is way Matz implemented partial orders.
For example, in cvs given

---
class Class
    include Comparable
end

class A; end
class B; end


# observing that A <=> B raises an ArgumentError would be
# enough to conclude that

A < B # => false
B < A # => false
---


To appease your valid concerns it might be better to only catch
``ComparableErrors'' lets say

module Comparable
    class Error < ArgumentError; end
    def  <(other)
        begin
            (self <=> other) < 0 ? true : false
        rescue  Error
            false
        end
    end
    # ...
end

....

/Christoph