[Glass] Question on Sets

Richard Sargent richard.sargent at gemtalksystems.com
Fri Apr 4 08:55:01 PDT 2014


SebastianHC wrote
> Set new add: MyClass new; add: MyClass new; yourself inspect
> then MyClass is twice in the Set,... I expected such behavior for
> IndentitySet and not Set.
> Similar problem with removing MyClass new from this very Set. The MyClass
> isn't found in the set eventhough it is there.

The most important factor in using Sets is the definition of equality and
hash. If you don't define #=, you typically inherit one from Object which
tests on identity. And you no doubt know that #hash must answer the same
value for objects that compare equal, if you want to be able to reliably use
them in hashed collections.




--
View this message in context: http://forum.world.st/Glass-Question-on-Sets-tp4752784p4752788.html
Sent from the GLASS mailing list archive at Nabble.com.


More information about the Glass mailing list