[on] why can't I write on a WriteStream on an OrderedCollection?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[on] why can't I write on a WriteStream on an OrderedCollection?

Oscar Nierstrasz

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
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [on] why can't I write on a WriteStream on an OrderedCollection?

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

Lukas

On Saturday, April 11, 2009, Oscar Nierstrasz <[hidden email]> 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
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

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

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [on] why can't I write on a WriteStream on an OrderedCollection?

Stéphane Ducasse
In reply to this post by Oscar Nierstrasz
Lukas already replied and this is for this reason that we should  
continue to work on Nile
because with Nile you get real streams.

Stef

On Apr 11, 2009, at 7:39 PM, Oscar Nierstrasz 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
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [on] why can't I write on a WriteStream on an OrderedCollection?

Damien Cassou
In reply to this post by Oscar Nierstrasz
On Sat, Apr 11, 2009 at 7:39 PM, Oscar Nierstrasz <[hidden email]> 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.

You should have listened when I presented Nile at ESUG some years ago :-)

--
Damien Cassou
http://damiencassou.seasidehosting.st

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [on] why can't I write on a WriteStream on an OrderedCollection?

Nicolas Cellier
While I believe Nile is certainly a valuable work, it is very easy to
patch old stream for this particular bug in the interim.
http://bugs.squeak.org/view.php?id=2390
http://bugs.squeak.org/view.php?id=7269
http://bugs.squeak.org/view.php?id=7296

Nicolas

2009/4/12 Damien Cassou <[hidden email]>:

> On Sat, Apr 11, 2009 at 7:39 PM, Oscar Nierstrasz <[hidden email]> 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.
>
> You should have listened when I presented Nile at ESUG some years ago :-)
>
> --
> Damien Cassou
> http://damiencassou.seasidehosting.st
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [on] why can't I write on a WriteStream on an OrderedCollection?

Stéphane Ducasse
http://code.google.com/p/pharo/issues/detail?id=729

On Apr 12, 2009, at 4:17 PM, Nicolas Cellier wrote:

> While I believe Nile is certainly a valuable work, it is very easy to
> patch old stream for this particular bug in the interim.
> http://bugs.squeak.org/view.php?id=2390
> http://bugs.squeak.org/view.php?id=7269
> http://bugs.squeak.org/view.php?id=7296
>
> Nicolas


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