Bug: Use of == for arithmetic equality
Diego Gomez Deck
DiegoGomezDeck at consultar.com
Tue Feb 14 08:55:39 UTC 2006
Hi,
Actually the confusion is in Object class.
All objects can be tested for identity (message #==) but it doesn't make
sense to offer messages for equality (message #=) all over the
hierarchy. Not all object has a good meaning of equality and, imho, to
give default equality (based on identity) make the confusion bigger.
I think to put equality in Object is one the the biggest misconceptions
we suffer daily. Only a small set of objects can answer for equality in
a senseful way.
If you combine this fact with the awful-object-capabilities of the
main-stream languages (where the objects never survive a run), you will
get an abuse of uses of equality. Most of the times, in those
languages, equality is just used to workaround the problems with the
(nonexistent) identity.
Cheers,
-- Diego
El lun, 13-02-2006 a las 16:25 -0800, tim Rowledge escribió:
> On 13-Feb-06, at 4:09 PM, Wolfgang Helbig wrote:
> >
> > Now, my question. Are SmallIntegers, Characters and Symbols in Squeak
> > immutable objects in the sense of the above definition, i, e. not
> > destroyable? If not, why and when was it changed in Squeak. If they
> > are
> > still immutable, why is this planned to be changed?
> SmallIntegers, Characters and Symbols are indeed immutable in Squeak.
> However, numbers in general are not quite the same; it is entirely
> possible to have several LargeIntegers with the same numeric value
> and that is one quite obvious case where using #== instead of #=
> could provide a surprise.
> All one has to do is remember tat #== means 'is the same object' and
> #= means 'is an equal object' to see that confusion is not smart.
>
> tim
More information about the Squeak-dev
mailing list
|