Markus Gerwinski wrote:
Frank Heckenbach wrote:
The first, or the most recent one, that's still a question. After some experimenting, there seem to be points for both ways. I'm implementing the latter now (though it should be easy to change). So, e.g.:
program Baz;
procedure Foo; var BaR: Integer; begin end;
begin WriteLn (bar) end.
will complain about an unknown identifier `bar', not `BaR' ...
That's quite natural, since the line in the main program _is_ the first occurence of `bar'.
No, it's the second occurrence of the *identifier* `bar' (with any case).
Outside procedure Foo, BaR isn't known at all.
As a declaration.
But what about this case?
Program Baz;
Procedure Foo ( Bar: integer ); begin end;
begin foo; end.
... would complain about a missing parameter calling procedure `foo' in line 8. However, I'd rather talk about procedure `Foo' here, since this one's the line to look up in the source in order to get the correct routine's parameter list. (The line where the error occurred is already denoted in the error message: line 8.)
Of course, with `-Widentifier-case', you'd get the line number with the case warning.
But perhaps it's more useful to output the position of the declaration with the error message (which I'm doing now). Then you don't have to search anything, and it works also if it's in a different file.
I'd generelly prefer to use the spelling of the _declaration_ of an identifier, not the spelling of a usage somewhere in the source.
I thought about this, but at a quick glance that's much more work. I think one would have to check all usages of a declaration, while identifier case can easily be checked during lexing. For my purposes, it doesn't seem worth the effort (since I myself prefer to use uniform casing of identifiers throughout), but of course, you're free to implement it yourself ...
But I'd prefer the compiler to run like this, since it leads exactly to the right line when looking it up with a case-sensitive text search.
Of course, there's no reason to do a case-sensitive search in Pascal code. ;-)
Frank