[BUG] ReadStream>>isEmpty ?
Ken Causey
ken at kencausey.com
Fri Aug 8 16:19:01 UTC 2003
On Fri, 2003-08-08 at 11:10, Chris Muller wrote:
> | myStream |
> myStream _ #(1 2 3) readStream.
> myStream isEmpty
>
> isEmpty returns true and this seems wrong to me.
>
> myStream size
>
> answers "3" as I would expect, and which also seems contrary to being empty.
>
> A fix seems easy, but would like to get comments from others on the group
> first.
>
> Comments?
>
My understanding of the using of isEmpty is that it refers to whether or
not to expect to get a value back on the next call to next or the like.
Note that when you create the stream it is positioned at the end and so
there are no further elements to be retrieved. You instead want to
| myStream |
myStream _ #(1 2 3) readStream reset.
myStream isEmpty
which returns true.
Ken
-------------- 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/1cfad598/attachment.pgp
More information about the Squeak-dev
mailing list
|