Dictionaries broken in 3.9a
stéphane ducasse
ducasse at iam.unibe.ch
Tue Sep 20 16:37:12 UTC 2005
Thanks chris since this is the question I was aksing myself.
Stef
On 20 sept. 05, at 07:40, Chris Muller wrote:
> Sorry if my "fix" disrupted you Andreas, I guess I fixed the wrong
> thing.
> But while Dictionary's appear able to contain nil keys afterall,
> what about
> WeakKeyDictionarys? As their keys are garbage-collected and
> converted to nil
> it would be unpredictable, at best.
>
> Therefore, what do you think of my overriding #associationsDo: in
> WeakKeyDictionary, which was the real crux of my original fix back
> in June of
> '04? I should have just stopped with this..
>
> associationsDo: aBlock
> "Evaluate aBlock for each of the receiver's elements (key/value
> associations)."
>
> super associationsDo:
> [ : eachAssoc | | eachKey |
> eachKey _ eachAssoc key. "reference to ensure no GC"
> eachKey ifNotNil: [ aBlock value: eachAssoc ] ]
>
> I've run with this since that time without any problem, but even
> better with
> expert feedback.
>
> Incidentally, there may be a few special side-effects to having a
> nil key in a
> regular Dictionary which could bite at some point. For example:
>
> (Dictionary new at: nil put: 'nil') keys
>
> Regards,
> Chris
>
>
>
>
More information about the Squeak-dev
mailing list
|