[BUG][FIX] WeakKeyDictionary>>keysAndValuesDo:
Chris Muller
afunkyobject at yahoo.com
Thu Jun 10 17:03:49 UTC 2004
> > Or, Set's could use
> > a different place holder than nil; they could do "Object new" to create
> > a unique placeholder object.)
>
> Seems to be a good idea to me. First I've thought of taking "self" as
> the placeholder, but then the Set couldn't contain itself...
True. I think "Object new" with identity-checking on the place-holder would be
hte way to go. Additionally, once keys in a WeakKeyDictionary are gc'd, we'd
need a way to differentiate those nil's from the place holder.
But this is something for the future. I just want to get the bug fixed.
> > Now, the "key" variable will keep the key from disappearing until aBlock
> > is through evaluating.
>
> This sounds good, but: are you sure?
> I'm quiet confident, that this is correct for the actual Squeak, but:
> wouldn't it be possible for a clever system to throw away (gc) variable
> "key" after the #ifNotNil: check? The evaluation of the block doesn't
> need "key". Are you sure, that this behavior is forbidden by some
> specification (not to say 'standard')?
Even if it isn't perfect for a clever system it is certainly an improvement and
it fixes my issue in Squeak for the moment. Currently, keysDo: works for me
and it doesn't even assign to a temp-var at all. I'll include a change for
that as well in my fix.
- Chris
More information about the Squeak-dev
mailing list
|