Ambiguous condition? If not, what should be the result
and what is it good for?
If the result differs but with no harmful effect then what would
you call that?
0 value fid
: print cr rot 2 .r ." ->" swap 2 .r 3 .r ;
: test
s" foo.txt" r/w create-file throw to fid
s" foobar" fid write-file throw
fid close-file drop
s" foo.txt" r/o open-file throw to fid
page
0 pad over fid read-line throw print
10 pad over fid read-line throw print
0 pad over fid read-line throw print
1 pad over fid read-line throw print
fid close-file drop cr
;
test
\\
SwiftForth
0 -> 0 -1
10 -> 6 -1
0 -> 0 0
1 -> 0 0
VFX
0 -> 0 -1
10 -> 6 -1
0 -> 0 -1
1 -> 0 0
Gforth
0 -> 0 -1
10 -> 6 -1
0 -> 0 -1
1 -> 0 0
NTF
0 -> 0 -1
10 -> 6 -1
0 -> 0 -1
1 -> 0 0
Win32Forth
0 -> 0 -1
10 -> 6 -1
0 -> 0 0
1 -> 0 0
dxf <dxforth@gmail.com> writes:
If the result differs but with no harmful effect then what would
you call that?
If the the behaviour of an implementation differs from what is
specified, I call that a bug.
0 value fid
: print cr rot 2 .r ." ->" swap 2 .r 3 .r ;
: test
s" foo.txt" r/w create-file throw to fid
s" foobar" fid write-file throw
fid close-file drop
s" foo.txt" r/o open-file throw to fid
page
0 pad over fid read-line throw print
10 pad over fid read-line throw print
0 pad over fid read-line throw print
1 pad over fid read-line throw print
fid close-file drop cr
;
test
\\
SwiftForth
0 -> 0 -1
10 -> 6 -1
0 -> 0 0
1 -> 0 0
VFX
0 -> 0 -1
10 -> 6 -1
0 -> 0 -1
1 -> 0 0
Gforth
0 -> 0 -1
10 -> 6 -1
0 -> 0 -1
1 -> 0 0
NTF
0 -> 0 -1
10 -> 6 -1
0 -> 0 -1
1 -> 0 0
Win32Forth
0 -> 0 -1
10 -> 6 -1
0 -> 0 0
1 -> 0 0
The specification requires:
|If the operation succeeded, flag is true and ior is zero.
[...]
|If the operation is initiated when the value returned by FILE-POSITION
|is equal to the value returned by FILE-SIZE for the file identified by |fileid, flag is false, ior is zero, and u2 is zero.
In the case of u1=0, both conditions can be true, and the
specification is contradictory. VFX, Gforth, and NTF apparently give priority to the first statement, SwiftForth and Win32Forth to the
second.
The specification should not be contradictory. It should specify for
this case whether flag should be true or false, or, if no consensus is reached, it should explicitly state that both results are acceptable.
ANS seems pedantic on EOF returning both u2=0 and
flag=0. The TC reiterated this in response to an RFI. But why? Who
checks u2 for EOF?
Omitted from the ANS spec is any mention of EOF characters for systems
that employ it e.g. CP/M and MS-DOS.
And if READ-LINE encounters such
there should be a way to report it.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 143:42:21 |
Calls: | 10,383 |
Calls today: | 8 |
Files: | 14,054 |
D/L today: |
2 files (1,861K bytes) |
Messages: | 6,417,671 |