Possible bug with Streams and upToEnd

Russell Penney russell.penney at tincanct.com
Tue Jul 13 04:20:08 UTC 2004


God forbid I change the basic laws of physics...I will leave it alone and
have a nice nap instead.

Now I know why people do:

( ReadWriteStream with: collection ) reset


Thanks
Russell

> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-
> bounces at lists.squeakfoundation.org] On Behalf Of tim Rowledge
> Sent: Tuesday, 13 July 2004 3:32 AM
> To: The general-purpose Squeak developers list
> Subject: Re: Possible bug with Streams and upToEnd
> 
> Russell Penney wrote:
> 
> > I was playing with streams and noticed something a bit weird.
> >
> >
> >
> > | s |
> >
> > s := ReadStream on: ( ByteArray new: 10 withAll: 32 ).
> >
> > s upToEnd
> >
> > ->  a ByteArray(32 32 32 32 32 32 32 32 32 32)
> >
> >
> >
> > | s |
> >
> > s := ReadWriteStream on: ( ByteArray new: 10 withAll: 32 ).
> >
> > s upToEnd
> >
> > -> a ByteArray()
> >
> >
> >
> > Is that right? Should they both return the same collection? Seems very
> > counter-intuitive to me as it is now, but I might be missing something.
> This is an astonishingly common 'problem' - searching various ST related
> archives would probalby find hundreds of unique threads on it.
> 
> Basically, since you didn't write anything to the ReadWriteStream you
> get back that nothing when you ask for what was written. I know, it's
> not all that logical seeming but that's what happens. Been that way for
> a long time and changing it would probably mess up the electron
> mass/charge ratio or something.
> 
> tim
> 






More information about the Squeak-dev mailing list