Default file for get and put
Original Reporter info from Mantis: helbig
-
Reporter name: Wolfgang Helbig
Original Reporter info from Mantis: helbig
- Reporter name: Wolfgang Helbig
Description:
This is not a bug report but a change request: The file parameter of get and put can be omitted. That is
get is equivalent to get(input) and put is equivalent to put(output) thus resembling all other file related predeclared procedures and functions. (with the exception to rewrite and reset, since they must not be applied to the standard files.)
This is far more beautiful than the ISO-standard allows! And, remember E.W. Dijkstra: Beauty is our Business.
Steps to reproduce:
$ cat >get.p
{$MODE ISO}
program p(input, output);
begin
get;
put
end.
$ fpc get.p
get.p(4,6) Error: Illegal expression
get.p(6,1) Error: Illegal expression
get.p(7) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/local/bin/ppcx64 returned an error exitcode
The parameter to get shall be defaulted to the input and to put to the output parameter of the program header
Additional information:
This is not demanded by ISO-7815. Here the output of the p5 compiler:
$ pcom get.p get.p5
P5 Pascal compiler vs. 1.3
Pascal-P5 complies with the requirements of level 0 of ISO/IEC 7185.
1 -32 {$MODE ISO}
2 -32 program p(input, output);
3 -32 begin
4 3 get;
4 **** ^9,2,4
5 6 put
6 6 end.
6 **** ^9,2,4
Errors in program: 6
Error numbers in listing:
-------------------------
2 Identifier expected
4 ')' expected
9 '(' expected
Jensen, Wirth: Pascal User Manual and Report, 3rd ed. reads on page 205: "If f is omitted, program parameter Input is assumed."
Strangely, this clause is not shown under the heading put(f).
I think, it
Mantis conversion info:
- Mantis ID: 37949
- OS: os x
- OS Build: 10.11
- Platform: imac
- Version: 3.2.0
- Fixed in version: 3.3.1
- Fixed in revision: 47147 (#4afa4a73)
- Monitored by: » helbig (Wolfgang Helbig)