Are you sure that your hash is stable (e.g. none of the objects are ever nil)? If the hash changes, the hash table might “loose” entries.
> On 24 Dec 2014, at 12:13, Dario Trussardi <[email protected]> wrote: > > Ciao, > > I wrok into Pharo Pharo1.4 Latest update: #14445 > > I have a strange behavior relative to hash and = methods > into one class. > > Sometimes when i do the code aBag occurrencesOf: anItem the > system answer 0 but into the bag there's the relative anItem instance. > > The problem is generated when in the anItem class definitions method, > > i do reference to a instance variable ( consumer ) setting to a > Symbol. > > The hash method is: > > hash > > ^item hash > bitXor:( opzioniVoce hash > bitXor:( referenceTime hash > bitXor:( consumer hash > bitXor:( newEntry hash )))) > > > The = method is: > > = anItem > > | rslPrz | > anItem ifNil:[^false]. > > self class = anItem class ifFalse:[ ^false]. > > rslPrz:= ( item = anItem item > and:[ opzioniVoce = anItem opzioniVoce > and:[ referenceTime = anItem > referenceTime > and:[ consumer > = anItem consumer > and:[ > newEntry = anItem newEntry ]]]]). > > ^ rslPrz > > > If i remove the consumer instance reference in the two methods all work > fine. > > any ideas about it ? > > Thanks, > > Dario > > > >
