dxforth <
[email protected]> writes:
READ-FILE READ-LINE REPOSITION-FILE contain clauses stating an ambiguous >condition exists if file is positioned outside the file boundaries.
AFAIK common practice in the real world is to allow file-positioning anywhere >and let the subsequent read/write handle it
What makes you think so? The first system I checked (Gforth on Linux)
behaves differently:
#200000. stdout reposition-file throw
*the terminal*:7:33: error: Illegal seek
#200000. stdout reposition-file >>>throw<<<
For a seekable file it seems that it indeed behaves as you describe:
[~/gforth:139436] echo >/tmp/xxx
[~/gforth:139437] gforth
...
s" /tmp/xxx" r/o open-file throw ok 1
constant xxx ok
#20000. xxx reposition-file throw ok
here 10 xxx read-file throw . 0 ok
In any case, given that all three words produce iors, an ambiguous
condition is not merited IMO. REPOSITION-FILE should either return a
non-zero ior, or a zero ior. Similarly, for READ-FILE and READ-LINE,
if the position is outside the written part of the file, they should
behave as you describe, or maybe return a non-zero ior (not sure if
there are any (operating or Forth) systems that need that). But who
is going to write the proposal?
- anton
--
M. Anton Ertl
http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs:
http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard:
https://forth-standard.org/
EuroForth 2022:
https://euro.theforth.net
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)