IWETHEY v. 0.3.0 | TODO
1,095 registered users | 1 active user | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Not aware
Not a ST expert by any means - but a couple of obvservations. First, you could save yourself a local variable if you want to just reallocate the coll object in place (see bellow). Second, you have to be careful that the "coll" variable is shared in all usages - the coll variable points to a new object as a result of the operation, but any other variables that pointed to the previous collection object still point to the object originally pointed to by coll. IOW, you end up with three objects as a result of the operation - one of which will be garbage collected if there are no other references holding on to it.

The only other thought that comes to mind is that ST only allows one value to be returned by a function. So if you wanted two collections to be returned, you'd have to have return a collection that contained both collections. That would probably be the more correct ST solution since it doesn't touch the original collection in the logic (i.e. rely on a variable being invisibly passed to the method).

|collToGo|

collToGo := coll select: [ : each | each stays not].
coll := coll select: [ : each | each stays].
self sendForth: collToGo.
New Re: Not aware
coll is a member variable in the class instance. It never escapes the instance - no methods return it. I am aware of having 3 objects at some point, and that's one of the reasons I am looking for a better solution.
     Smalltalk Question - (Arkadiy) - (16)
         Isn't there a reject message? - (static) - (8)
             Re: Isn't there a reject message? - (Arkadiy) - (7)
                 Yes - (Fearless Freep) - (6)
                     Yes... Yes! Yes! - (Arkadiy)
                     So how's it done? - (ChrisR) - (4)
                         I don't get it - (Fearless Freep) - (3)
                             Never mind... - (ChrisR) - (2)
                                 heh heh heh - (static)
                                 Standard or not? - (Arkadiy)
         Not aware - (ChrisR) - (1)
             Re: Not aware - (Arkadiy)
         Speaking of smalltalk - (wharris2) - (4)
             Re: Speaking of smalltalk - (tuberculosis)
             Re: Speaking of smalltalk - (Arkadiy) - (2)
                 Fortunately - (Fearless Freep) - (1)
                     I don't think _I_ could do without. - (Arkadiy)

Hail Eris.
122 ms