From: Marcin 'Qrczak' Kowalczyk Date: 2003-05-20T21:59:16+09:00 Subject: Re: Ruby reference recommendations Dnia wto 20. maja 2003 12:11, Robert Klemme napisa�: > :-)) And you have to include Java in the list - because of its primitive > types. Well, in some respects it doesn't matter that they are represented differently, since they are immutable. You can think about them as references to immutable number objects. They are passed to functions and returned from them and stored in data structures in the same way as regular objects. Arithmetic operations always return the same object for the given value, so == works as for references. The only conceptual differences are when you can't implicitly coerce them to object class and back, that "references" to them can't be nil, that you can't synchronize on them, and perhaps other things like this. And it's bad that identity is the "default" equivalence, which happens to work on primitive types and mutable objects. Immutable objects should be always compared by value - this includes immutable strings and large numbers, but in Java the proper comparisons for them are different than for ints. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/