[Pharo-project] [on] why can't I write on a WriteStream on an OrderedCollection?
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
Squeak streams only work on Array and String instances. The power of objects ;-) Lukas On Saturday, April 11, 2009, Oscar Nierstrasz <oscar@iam.unibe.ch> 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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Lukas Renggli http://www.lukas-renggli.ch
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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
On Sat, Apr 11, 2009 at 7:39 PM, Oscar Nierstrasz <oscar@iam.unibe.ch> 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
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 <damien.cassou@gmail.com>:
On Sat, Apr 11, 2009 at 7:39 PM, Oscar Nierstrasz <oscar@iam.unibe.ch> 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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
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
participants (5)
-
Damien Cassou -
Lukas Renggli -
Nicolas Cellier -
Oscar Nierstrasz -
Stéphane Ducasse