[BUG] ReadStream>>isEmpty ?

Ken Causey ken at kencausey.com
Fri Aug 8 16:59:04 UTC 2003


Oops.  That's what I get for not looking more carefully.  I've run into
the reset issue before and jumped to a conclusion based on the isEmpty
test testing for a position value of 0.  Why I thought streams would
consider 0 the end I can't explain.

Ken

On Fri, 2003-08-08 at 11:53, Andreas Raab wrote:
> > Well there is the potential here for an interesting debate.
> 
> I don't see any. When you ask for #(1 2 3) readStream next you get 1 (just
> as expected). I can't see why we would want #(1 2 3) readStream isEmpty ever
> to answer true then.
> 
> > As it stands what is happening (conceptually) is that the stream
> > is created empty and that the values are written to it and then 
> > the stream is returned.
> 
> No, that's wrong. You are actually saying it yourself:
> 
> > | myStream |
> >
> > myStream _ #(1 2 3) readStream reset.
> > myStream isEmpty
> > 
> > which returns true.
> 
> It answers _true_ after you reset it, e.g., the read stream claims to be
> empty even though it will happily answer a value when you ask for the #next
> element.
> 
> > Which is right?  *shrug*
> 
> Clearly, the current behavior of #isEmpty is wrong.
> 
> Cheers,
>   - Andreas
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030808/403e7f7c/attachment.pgp


More information about the Squeak-dev mailing list