ReadStream and skipping past the end

Martin Kuball MartinKuball at web.de
Fri Mar 11 19:27:00 UTC 2005


Am Thursday 10 March 2005 23:30 schrieb Boris Gaertner:
> "Martin Kuball" <MartinKuball at web.de> wrote:
> > 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.
>
> We have the same behavior in
> StandardFileStream>>basicNext.
>
> CrLfFileStream>>upTo:  and
> CrLFFileStream>>next
> check for nil to detect the end-of-file

Yes, but that was not my point. It was decided that ReadStream does 
not signal an error when reading past the end. And I think neither 
should the skip method. If only for consistency.

Martin



More information about the Squeak-dev mailing list