ReadStream and skipping past the end
Martin Kuball
MartinKuball at web.de
Thu Mar 10 20:08:11 UTC 2005
Hi!
The comment in method PositionableStream>>#skip: says:
"Set the receiver's position to be the current position+anInteger. A
subclass might choose to be more helpful and select the minimum of
the receiver's size and position+anInteger, or the maximum of 1 and
position+anInteger for the repositioning."
Now why is this not implemented right there? Or at least in the
subclass ReadStream? I think this would be more compatible to the
behaviour of the method #next when reading past the end. It just
return nil. No error signaled.
Now you may say, get the size of the stream and check before sending
the #skip: But I think working explicitly with the size of a stream
is somewhat ugly.
By the way there is a class EndOfStream which was appearantly designed
to signal an error when reading past the end. But it is not used. And
I think it should not. So maybe the class should be removed.
Martin
More information about the Squeak-dev
mailing list
|