List Info

Thread: Re: WeakSet>>#includes: without unneeded HomedAssociations




Re: WeakSet>>#includes: without unneeded HomedAssociations
country flaguser name
Switzerland
2007-06-12 01:46:25
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



_______________________________________________
help-smalltalk mailing list
help-smalltalkgnu.org

http://lists.gnu.org/mailman/listinfo/help-smalltalk

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )