Ciao Dario

Pharo 1.4 is at least 3 years old so you should really consider to migrate.
You **cannot** imagine how many improvements we did since then.

Stef

Le 24/12/14 12:13, Dario Trussardi a écrit :
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

        



Reply via email to