David James wrote:
Having now looked at an 'Object Pascal Language Guide' that came with a copy of Borland Delphi for Windows, I'm not convinced that class is being handled in the Delphi manner. This Guide says "Unlike other types, a class type can be declared only in a type declaration part in the outermost scope of a program or unit. Therefore, a class type can't be declared in a variable declaration part or within a procedure, function, or method block."
So an example similar to the example I posted last night:
program test_class(input,output);
type tcomp=packed record name:string[80]; class:1..15; end; var comp:tcomp;
begin end.
should fail.
However, I think the following example:
program test_class2(input,output);
procedure proc; type tcomp=packed record name:string[80]; class:1..15; end; var comp:tcomp;
begin end;
begin proc; end.
should compile (and it doesn't).
I suppose that, while class declarations are allowed only globally in the outermost scope, `class' is a reserved word throughout. That's what the Chief said Delphi does, and what I know TP does with `object'.
We could try to make `class' conditionally reserved only in the outermost scope, but I don't know how hard this would be (Peter?), and it wouldn't solve the issue completely. So I think I'd prefer `disable-keyword' as well...
I think the "news" section of the first part of the manual should document the introduction of class as a conditionally reserved word.
I'm a little surprised. According my old copy of the 19990118 sources, `class' was already conditionally reserved there. But anywaym I will document it, as well as `attribute' and `published' which have become (conditional) keywords since that version AFAICT. If there are more keywords I should mention, let me know.
Frank