[ENH???] Re: Weak references Once more

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Tue Nov 30 21:19:12 UTC 1999


One more fix,

a minimal change. Now I haven't found any problems for hours...

Henrik

!WeakRefillArray methodsFor: 'adding/copying' stamp: 'hg 11/30/1999 15:53'!
copyWith: element
    "NB. Non-standard behavior optimized for using WeakArrays:
     Answer a copy of the receiver that is 1 bigger than the receiver and
     includes the argument, newElement, at the end,
     IF there isn't already an empty position which can be reused. hg
11/30/1999 11:00"

    | index size | 
    "cannot use inherited enumeration methods since I have overridden do: to
skip nil:s"
    index _ 1. size _ self basicSize.
    [index <= size and: [(self at: index) ~~ nil]] whileTrue: [index _ index
+ 1].
    index <= size 
        ifTrue: [self at: index put: element.  ^self]
        ifFalse: [^self privateCopyWith: element]! !





More information about the Squeak-dev mailing list