You haven't set the writeLimit by just copying PositionableStream though, have you?
I suggested to copy PositionableStream>>on: in ReadWriteStream: on: aCollection collection := aCollection. readLimit := aCollection size. position := 0. self reset Your implementation works well too, it has no duplication, but has a dependency over the implementation of the superclass. Cheers, Alexandre
On Jun 30, 2009, at 3:00 46PM, Alexandre Bergel wrote:
Put the readLimit at 0 make sense for a WriteStream ( with witch your not supposed to read ) but when you create a ReadWriteStream on a collection you would be able to read what is already in the collection, no? I wonder why #on: has not been overriden in the instance side of ReadWriteStream ? Maybe it's not a good idea to create a ReadWriteStream with a collection that already includes elements ?
It looks like on: must be overridden in ReadWriteStream. With ReadStream I have: (ReadStream on: (1 to: 20)) next => 1 (ReadStream on: (1 to: 20)) next; next => 2
However, with ReadWriteStream, nil is returned, for the very problem you mentioned: (ReadWriteStream on: (1 to: 20)) next => nil
If I cut and paste PositionnableStream>>on: in ReadWriteStream, then I have the behavior I expected: (ReadWriteStream on: (1 to: 20)) next => 1 (ReadWriteStream on: (1 to: 20)) next; next => 2
Cheers, Alexandre
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.