Bug or feature in StandardFileStream

Martin Kuball martinkuball at web.de
Sun Feb 12 20:56:56 UTC 2006


Am Sunday, 12. February 2006 16:02 schrieb David T. Lewis:
> On Sun, Feb 12, 2006 at 03:38:34PM +0100, nicolas cellier wrote:
> > Le Dimanche 12 Février 2006 15:19, David T. Lewis a écrit :
> > > It's a feature. It just means that you can set the file
> > > position beyond end of file, at which point it is no longer
> > > "atEnd". You can use #setToEnd to position the file pointer to
> > > the actual end of file.
> >
> > Maybe it's a usefull feature for files opened for writing, I
> > don't know.
> >
> > But Martin had its file opened readOnly, in which case such a
> > feature makes no sense.
> >
> > What would file next will answer? an infinite collection of zeros
> > like a null stream ?
>
> It answers nil.

Well, I was afraid that this would be the answer. But that means a 
read only file stream does behave different than a read stream on a 
collection. And you can't use a file stream in place of a read stream 
if the code does not know. So I guess I have to use something like
stream position < stream size to check if I'm still at a valid 
position.

> > Everybody would prefer getting an Exception rather than this
> > strange behavior i guess.
>
> Agreed.
>
> Note the squeak file system code was written many years before the
> introduction of exceptions, and there is wide agreement that it is
> due for some rework. There is a team forming up to look into this:
>
>  <http://www.squeak.org/Community/Teams/>
> 
> <http://lists.squeakfoundation.org/pipermail/squeak-dev/2006-Januar
>y/099050.html>
>
> Dave

Martin



More information about the Squeak-dev mailing list