3 ms·
The #equal? method does your object_id comparison, by the way. Ruby's default #== for new classes simply performs identity comparison, just like in Java. The d
by koenigdavidmj 12y ago
The #equal? method does your object_id comparison, by the way.
Ruby's default #== for new classes simply performs identity comparison, just like in Java. The difference is that Ruby has operator overloading, so all the builtin classes overload it with something sensible.
(This could work in Java, or it could go the .NET route and ban using the == operator entirely until a certain interface (.NET's IEquatable) is fulfilled.)