"Joshua Scholar" jscholar@access4less.net wrote:
Since I was only talking about iterating over primitive types like arrays, it's not possible to change the size of the collection while iterating over it.
Really? Consider what happens in this:-
|array newArray| array := Array new:10. 1 to: array size do:[:i| array at: i put: i squared]. "ok" array do:[:el| newArray := Array new: el +3. array become: newArray]
Warning - this code might cause brain damage. Never underestimate the excitment #become: can cause, nor how often some demented ninny will spring it upon you.
A more prosaic example might be a stream on an Array. You can add extra elements to the array which in the Squeak implementation replaces the array with a bigger one BUT IIRC older Smalltalks used a become to do that grow. Now add in multiple threads and life can get very complicated.
tim -- Tim Rowledge, tim@sumeru.stanford.edu, http://sumeru.stanford.edu/tim Useful random insult:- Talks to plants on their own level.