Streaming on all collections

Philippe Marschall philippe.marschall at gmail.com
Sun Feb 11 21:46:58 UTC 2007


2007/2/11, Alan Lovejoy <squeak-dev.sourcery at forum-mail.net>:
> <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.

The same as GST.  Smalltalk/X however "does the right thing" as well.

Philippe



More information about the Squeak-dev mailing list