Streaming on all collections

Alan Lovejoy squeak-dev.sourcery at forum-mail.net
Sun Feb 11 20:46:54 UTC 2007


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

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

this generates a 'attempt to index non-existent element in an ordered
collection'
</Damien Cassou>

In VisualWorks, the following code "does the right thing":

(WriteStream on: OrderedCollection new)
	nextPut: $H;
	nextPut: $e;
	nextPut: $l;
	nextPut: $l;
	nextPut: $o;
	nextPut: $ ;
	nextPut: $W;
	nextPut: $o;
	nextPut: $r;
	nextPut: $l;
	nextPut: $d;
	nextPut: $!;
	contents

I fail to grok why Squeak should not do likewise.

--Alan

P.S. Dolphin works (or rather, fails to work) just like Squeak in this
regard.





More information about the Squeak-dev mailing list