[squeak-dev] Should Dictionary associations be shared?

Frank Shearar frank.shearar at gmail.com
Sat Dec 22 20:04:18 UTC 2012


On 22 December 2012 19:53, Chris Muller <ma.chris.m at gmail.com> wrote:
> This following assertion fails.
>
> |d1 d2 | d1:=Dictionary new.  d2:=Dictionary new.
> d1 at: 'one' put: 1.   d2 at: 'two' put: 2.
> d1 addAll: d2.
> d2 at: 'two' put: nil.
> self assert: (d1 at: 'two')=2
>
> To me it seems like Associations should not be shared between
> Dictionary's.  Thoughts?

Associations should not be shared between Dictionaries. That kind of
sharing works well with immutable data structures, but Dictionary is
mutable. Thus, the sharing can cause things distant in space and time
to influence each other's behaviour, which would make for an
unpleasant debugging session.

frank


More information about the Squeak-dev mailing list