The issue: 
https://pharo.fogbugz.com/f/cases/16760/Dictionary-breaks-when-comparing-identity-and-non-identity-dictionaries

> Sent: Sunday, October 11, 2015 at 7:23 AM
> From: monty <[email protected]>
> To: [email protected]
> Subject: Re: [Pharo-dev] hash and Collections
>
> Resending because the last was HTML'd:
> 
> Never use #newFrom: with associations from another dictonary if you reuse the 
> first after.
>  
> The bug is actually deeper than you know:
> dic1 := Dictionary newFrom:{'test' -> 4}.
> dic2 := IdentityDictionary newFrom: {'test' copy -> 4}.
> dic1 = dic2.
> dic2 = dic1.
>  
> Depending on the order, they are equal or inequal.
>  
> The bug is caused by Dictionary>>= using a polymorphic type test 
> #isDictionary. Squeak is unaffected: its #= uses a hardcoded class == test. 
> The least disruptive fix I can think of is adding another type test 
> #isIdentityDictionary in Dictionary that returns false but returns true for 
> every identity dictionary class (like SmalllIdentityDictionary). Then only 
> compare the associations if "self isIdentityDictionary = aDictionary 
> isIdentityDictionary".
>  
> I will open an issue.
> 
>

Reply via email to