Squeak streams only work on Array and String instances. The power of objects ;-)

Lukas

On Saturday, April 11, 2009, Oscar Nierstrasz <[email protected]> wrote:
>
> Can anyone explain to me why this works fine:
>
> ((WriteStream on: (Array new)) nextPut: #foo) contents.
>
> but this doesn't?
>
> ((WriteStream on: (OrderedCollection new)) nextPut: #foo) contents.
>
> The debugger shows that WriteStream>>nextPut: invokes
> WriteStream>>pastEndPut: which invokes at:put: on the collection.
>
> This is ok for an array, but not for an OrderedCollection, as
> OrderedCollection>>at:put: explicitly states it cannot be used to
> append stuff to the end of the collection.
>
> Is it a bug in WriteStream that it sends at:put:, or does it just not
> make sense to have a WriteStream on an Ordered Collection?
>
> (This is related to the split and join methods -- because of this
> limitation, an OrderedCollection cannot be used as a joiner, it seems.)
>
> - on
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

-- 
Lukas Renggli
http://www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to