[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] FilePlugin>>primitiveFileAtEnd for non-regular files (#232)

David T. Lewis lewis at mail.msen.com
Sat Mar 31 16:35:50 UTC 2018


On Sat, Mar 31, 2018 at 09:01:49AM -0700, Nicolas Cellier wrote:
>  
> The discussion on vm-dev shows that this tries to solve a problem which rather is at image side in latest Pharo.
> See http://lists.squeakfoundation.org/pipermail/vm-dev/2018-March/027341.html
> and that we should aim at simplifying the implementation rather than complexifying
> See http://lists.squeakfoundation.org/pipermail/vm-dev/2018-March/027343.html
> 
> About the simplification, wasn't there another effort to remove the cached file size?
> And excuse the naive question, but why feof() would not work for all cases?
>

It is not naive, and it is definitely not obvious.

The answer I would give is that the feof() test has a different meaning from
"at end of file". The feof() test determines if an end of file flag was set
in some previous operation. If the flag is set, then you know that you are
at the end of file. But if it is not set, you could still be at the end of
file position, in which case the end of file flag will be set the next time
you attempt to do a read.

Thus if we want atEnd to mean "at the end now, and the next read will produce
an error", then the feof() cannot answer that.

Dave



More information about the Vm-dev mailing list