ReadWriteStream issues

Anthony Adachi adachipro at yahoo.com
Mon May 5 16:41:25 UTC 2003


 goran.hultgren at b...  wrote:
 >However, if you try your code with ReadStream
instead it works. 
 
Okay, I tried ReadStream and it works up to a certain
point with the  "Squeak: A Quick Trip to ObjectLand"
book's examples. For instance these messages work as
expected.

s :=ReadStream on: #(1 2).
s next.
s next.
s atEnd.
s reset.
s next.
s position.

However, since the class is ReadStream I assume that
means it isn't meant to support writes? The above and
following examples from the book used ReadWriteStream.
If these sample message sends are sent to an
ReadStream instance instead they produce errors.
Which, I assume comes at no surprise. 

s nextPut: 7 "Error: this message is not appropriate
for this object."
s nextPut: 8 "ditto"
s nextPutAll: 'AB'. "ditto"

>  I can't remember exactly but I think it was
something about the
>  inherited class side #on: method that evidently got
"inherited" a bit by
>  mistake. I think the Stream and Collection
hierarchy are full of those
>  "mistakenly" inherited little methods.

Does this mean one should use a different class other
than ReadWriteStream if one needs the same state and
behaviour as shown in the book? Or does one need to
call a method other than on: or with: ?
 
>  I actually even hear a small bell ringing somewhere
back in my head that
>  I posted about this issue... or at least something
related a loooong way
>  back. I think I did anyway, but it was so long ago
I couldn't find any
>  reference to it.

Yesterday, I searched the list for "ReadWriteStream"
but I didn't find much. I just did a search now for
"ReadStream" and didn't see anything about this issue
either.

Does anyone know if there been a change to the
ReadWriteStream class in Squeak since the book was
written? Or if this might be a case of a printing
error in the book and the wrong class was shown in the
examples?

Thanks,

Anthony

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com



More information about the Squeak-dev mailing list