cyclic looping with [0 == object] whileFalse: [object := object
rootbeer at redcat.com
Mon Nov 5 18:40:01 UTC 2007
On 11/5/07, Rob Withers <reefedjib at yahoo.com> wrote:
> | object count objects |
> objects := OrderedCollection new: 1000000.
> count := 0.
> object _ nil.
> [0 == object or: [count > 500000]] whileFalse: [
> count := count + 1.
> objects add: object.
> object isMorph ifTrue: [object removeProperty: #undoGrabCommand].
> object _ object nextObject].
Now that I look at this code again, I see more. (What's the last line
supposed to be doing?) The method looks to be building a collection of
all (or up to half a million) objects in object memory, for no
apparent reason. As a side effect, or maybe its main effect, it
affects some Morphs.
Let's take care of the Morphs first. You probably want to process all
of them, not just many of them, so maybe something like this:
Morph allSubInstancesDo: [:m |
m removeProperty: #undoGrabCommand ].
If you really want a collection of all (or up to half a million)
objects from memory, that's easily done as well, built around
SystemNavigation default allObjectsDo: [:ob | "....whatever...." ].
But there's probably a better way to do what you want to do than to
build a collection of most of the items in the object memory.
More information about the Squeak-dev