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

Nicolas Cellier notifications at github.com
Sun Apr 1 15:09:06 UTC 2018


Hi Both,
thanks for the feof() explanation, I should have known this.
So, it shows that we are not on the right track.
The right way to do it on Unix is to try to read and check if atEnd in
post-condition rather than trying to test atEnd in pre-condition.
This is exactly as suggested by Levente.
Or even better, get some end-of-file error condition directly in response
to read primitive, and handle that gracefully at image side.

IMO primitiveFileAtEnd should rather be deprecated.


2018-03-31 18:35 GMT+02:00 OpenSmalltalk-Bot <notifications at github.com>:

> 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
>
>> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/232#issuecomment-377705650>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAscIrim1_6lcCunTBfwxNA7jtNToY5Kks5tj7BugaJpZM4S6rMa>
> .
>


-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/232#issuecomment-377793153
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180401/5669543d/attachment.html>


More information about the Vm-dev mailing list