1.8.0 changes behavior of == in Comparable

Running my unit tests with 1.8.0, I noticed that the behavior of == in
Comparable has changed from 1.6.8 to 1.8.0. In 1.6.8, if <=> raises an
exception, == catches it and returns false. In 1.8.0, == doesn’t catch the
exception.

This change seems reasonable, but I’d be interested in learning more about
the reasoning behind it. Anybody care to comment?

Thanks!

See [ruby-talk:40612] and the following thread (particularly
[ruby-talk:40625] and [ruby-talk:40772]).

Paul

···

On Fri, Dec 27, 2002 at 12:08:21AM +0900, Tim Hunter wrote:

Running my unit tests with 1.8.0, I noticed that the behavior of == in
Comparable has changed from 1.6.8 to 1.8.0. In 1.6.8, if <=> raises an
exception, == catches it and returns false. In 1.8.0, == doesn’t catch the
exception.

This change seems reasonable, but I’d be interested in learning more about
the reasoning behind it. Anybody care to comment?

Hi,

···

In message “1.8.0 changes behavior of == in Comparable” on 02/12/27, “Tim Hunter” cyclists@nc.rr.com writes:

Running my unit tests with 1.8.0, I noticed that the behavior of == in
Comparable has changed from 1.6.8 to 1.8.0. In 1.6.8, if <=> raises an
exception, == catches it and returns false. In 1.8.0, == doesn’t catch the
exception.

This change seems reasonable, but I’d be interested in learning more about
the reasoning behind it. Anybody care to comment?

Performance. 1.6 “<=>” method reported its errors by exceptins,
whereas 1.8 “<=>” would report errors by returning nil.

						matz.