Streaming on all collections

Jon Hylands jon at huv.com
Sun Feb 11 17:19:29 UTC 2007


On Sun, 11 Feb 2007 18:00:10 +0100, Damien Cassou
<damien.cassou at laposte.net> wrote:

> why isn't it possible to stream over OrderedCollections ?

You can only add elements to an OrderedCollection by using #add: (or one of
its variants). WriteStream assumes that if you send #new: to the class of
the collection it is streaming over, you can then say #at: index put:
value, where index <= the collections size.

If you want to do this, use Array.

stream := WriteStream on: Array new.
stream nextPut: $a

Later,
Jon

--------------------------------------------------------------
   Jon Hylands      Jon at huv.com      http://www.huv.com/jon

  Project: Micro Raptor (Small Biped Velociraptor Robot)
           http://www.huv.com/blog



More information about the Squeak-dev mailing list