On Mon, Jan 27, 2003 at 06:09:42AM +0100, Frank Heckenbach wrote:
Emil Jerabek wrote:
On Thu, Dec 19, 2002 at 05:21:11AM +0100, Frank Heckenbach wrote:
Artur Zaroda wrote:
[...]
program az35(output); var output:file of real; begin writeln('failed') (* WRONG - output is not of type "text" *) end.
Is it not already an error to (re)declare `Output' as a variable?
`Output' is an identifier, not a keyword, so it may be redefined freely.
I didn't mean to imply it was a keyword, rather a duplicate identifier.
But then it stops to be magic, i.e. it can't be used as an implicit file parameter of Write(Ln), it needs an explicit Rewrite, and (contrary to usual Pascal conventions for shadowing predefined identifiers) it mustn't occur in the program parameter list (see ISO 10206 6.12). Thus az35 is faulty for at least three separate reasons, which may be isolated as follows (Out1 fails in GPC, Out[23] work):
Thanks for the diagnosis. Fixed now (emil23*.pas).
Just to be sure, the following is also correct, isn't it?
program Out6 (Output); (* FLAG --classic-pascal *)
procedure Foo; var Output: Text; begin WriteLn ('OK') end;
begin Foo end.
It is, IIUIC.
Emil