Hi Both,<br>
thanks for the feof() explanation, I should have known this.<br>
So, it shows that we are not on the right track.<br>
The right way to do it on Unix is to try to read and check if atEnd in<br>
post-condition rather than trying to test atEnd in pre-condition.<br>
This is exactly as suggested by Levente.<br>
Or even better, get some end-of-file error condition directly in response<br>
to read primitive, and handle that gracefully at image side.<br>
<br>
IMO primitiveFileAtEnd should rather be deprecated.<br>
<br>
<br>
2018-03-31 18:35 GMT+02:00 OpenSmalltalk-Bot <notifications@github.com>:<br>
<br>
> On Sat, Mar 31, 2018 at 09:01:49AM -0700, Nicolas Cellier wrote:<br>
> ><br>
> > The discussion on vm-dev shows that this tries to solve a problem which<br>
> rather is at image side in latest Pharo.<br>
> > See http://lists.squeakfoundation.org/pipermail/vm-dev/2018-<br>
> March/027341.html<br>
> > and that we should aim at simplifying the implementation rather than<br>
> complexifying<br>
> > See http://lists.squeakfoundation.org/pipermail/vm-dev/2018-<br>
> March/027343.html<br>
> ><br>
> > About the simplification, wasn't there another effort to remove the<br>
> cached file size?<br>
> > And excuse the naive question, but why feof() would not work for all<br>
> cases?<br>
> ><br>
><br>
> It is not naive, and it is definitely not obvious.<br>
><br>
> The answer I would give is that the feof() test has a different meaning<br>
> from<br>
> "at end of file". The feof() test determines if an end of file flag was set<br>
> in some previous operation. If the flag is set, then you know that you are<br>
> at the end of file. But if it is not set, you could still be at the end of<br>
> file position, in which case the end of file flag will be set the next time<br>
> you attempt to do a read.<br>
><br>
> Thus if we want atEnd to mean "at the end now, and the next read will<br>
> produce<br>
> an error", then the feof() cannot answer that.<br>
><br>
> Dave<br>
><br>
> —<br>
> You are receiving this because you commented.<br>
> Reply to this email directly, view it on GitHub<br>
> <https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/232#issuecomment-377705650>,<br>
> or mute the thread<br>
> <https://github.com/notifications/unsubscribe-auth/AAscIrim1_6lcCunTBfwxNA7jtNToY5Kks5tj7BugaJpZM4S6rMa><br>
> .<br>
><br>


<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you commented.<br />Reply to this email directly, <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/232#issuecomment-377793153">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AhLyWyBXKtXvrNNHCTfKbTHdMyZW7Nlpks5tkO2SgaJpZM4S6rMa">mute the thread</a>.<img src="https://github.com/notifications/beacon/AhLyW6Cz8oTsLE_dShTt6xC0YicJ7IPQks5tkO2SgaJpZM4S6rMa.gif" height="1" width="1" alt="" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/232#issuecomment-377793153"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@nicolas-cellier-aka-nice in #232: Hi Both,\nthanks for the feof() explanation, I should have known this.\nSo, it shows that we are not on the right track.\nThe right way to do it on Unix is to try to read and check if atEnd in\npost-condition rather than trying to test atEnd in pre-condition.\nThis is exactly as suggested by Levente.\nOr even better, get some end-of-file error condition directly in response\nto read primitive, and handle that gracefully at image side.\n\nIMO primitiveFileAtEnd should rather be deprecated.\n\n\n2018-03-31 18:35 GMT+02:00 OpenSmalltalk-Bot \u003cnotifications@github.com\u003e:\n\n\u003e On Sat, Mar 31, 2018 at 09:01:49AM -0700, Nicolas Cellier wrote:\n\u003e \u003e\n\u003e \u003e The discussion on vm-dev shows that this tries to solve a problem which\n\u003e rather is at image side in latest Pharo.\n\u003e \u003e See http://lists.squeakfoundation.org/pipermail/vm-dev/2018-\n\u003e March/027341.html\n\u003e \u003e and that we should aim at simplifying the implementation rather than\n\u003e complexifying\n\u003e \u003e See http://lists.squeakfoundation.org/pipermail/vm-dev/2018-\n\u003e March/027343.html\n\u003e \u003e\n\u003e \u003e About the simplification, wasn't there another effort to remove the\n\u003e cached file size?\n\u003e \u003e And excuse the naive question, but why feof() would not work for all\n\u003e cases?\n\u003e \u003e\n\u003e\n\u003e It is not naive, and it is definitely not obvious.\n\u003e\n\u003e The answer I would give is that the feof() test has a different meaning\n\u003e from\n\u003e \"at end of file\". The feof() test determines if an end of file flag was set\n\u003e in some previous operation. If the flag is set, then you know that you are\n\u003e at the end of file. But if it is not set, you could still be at the end of\n\u003e file position, in which case the end of file flag will be set the next time\n\u003e you attempt to do a read.\n\u003e\n\u003e Thus if we want atEnd to mean \"at the end now, and the next read will\n\u003e produce\n\u003e an error\", then the feof() cannot answer that.\n\u003e\n\u003e Dave\n\u003e\n\u003e —\n\u003e You are receiving this because you commented.\n\u003e Reply to this email directly, view it on GitHub\n\u003e \u003chttps://github.com/OpenSmalltalk/opensmalltalk-vm/pull/232#issuecomment-377705650\u003e,\n\u003e or mute the thread\n\u003e \u003chttps://github.com/notifications/unsubscribe-auth/AAscIrim1_6lcCunTBfwxNA7jtNToY5Kks5tj7BugaJpZM4S6rMa\u003e\n\u003e .\n\u003e\n"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/232#issuecomment-377793153"}}}</script>