help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] [patch] WeakSet>>#includes: without unneeded HomedA


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] [patch] WeakSet>>#includes: without unneeded HomedAssociations
Date: Tue, 12 Jun 2007 08:46:25 +0200
User-agent: Thunderbird 2.0.0.0 (Macintosh/20070326)

Stephen Compall wrote:
On Mon, 2007-06-11 at 13:39 +0200, Paolo Bonzini wrote:
I don't especially like the patch, but given the current implementation of WeakSets it's probably the best idea. An alternative would be to reimplement #findIndex: and #add: as in Dictionary (and add a few other affected methods, like #rehashObjectsAfter:). For now I'll keep yours.

Specifically, added #addWhileGrowing:, #shallowCopy, and #deepCopy as
well.

smalltalk--backstage--2.2--patch-34 against patch-395 (also attached)

Thanks.  I also refactored the creation of HomedAssociation:

newAssociation: key
    ^HomedAssociation key: key value: nil environment: self
        makeEphemeron;
        yourself!

Now the next step would be to add

   HashedCollection >> findElementIndex: anObject [
       ^self findIndex: anObject
   ]
   Dictionary >> findElementIndex: anObject [
       ^self findIndex: anObject key
   ]
   LookupTable >> findElementIndex: anObject [
       ^self findIndex: anObject
   ]
   WeakSet >> findElementIndex: anObject [
       ^self findIndex: anObject key
   ]

This would be used to find the index corresponding to an *existing* item, as required in #rehashObjectsAfter: and #addWhileGrowing:.

Paolo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]