Sorry, I was incomplete. "Reserved words" which cannot be redefined and are basically part of the dialect defined by the current mode, vs "predefined".
Okay. I believe we'll all agree that these (and only these) are "Reserved words". The fact is the full list of these depends on compiler mode.
However there's a massive problem with the predefineds: there's obviously some in the System unit which are unavoidable, (False and True as specific examples since Boolean is a Pascal mandatory type), vs e.g. BeginThread which is not part of any standardised dialect.
I surely wouldn't include every identifier defined in System unit (or objpas which is also implicitly imported in some compiler modes). There are words which are part of the language syntax itself, such as class visibility specifiers (private, public, ...), routine or method modifiers (override, static, abstract, stdcall, ...), fundamental type names (boolean, char, ...), flow control statements (break, continue, exit), etc.
These can be used as identifiers in some places, but not always. For example you can not declare class member variable named
private (not even if you write
var explicitely above it), but you can declare a local variable
private in a function's var section.
unit Unit2;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils;
type
TSomeClass = class(TObject)
public
//private: Boolean; // this does not compile
//var protected: Boolean; // neither does this
end;
implementation
procedure SomeProcedure;
var
private: Boolean;
Boolean: Char;
protected: System.Boolean; // Boolean is redeclared above, now you must use System prefix.
Char: SmallInt;
Break: Word;
begin
//
end;
end.
But if we assume that String is a reserved word and predefined type, and that the SysUtils unit is almost always imported, how do we deal with the postfix operators that are added whether the programmer intends (or realises) it or not i.e. string.ToInteger and so on?
MarkMLl
I surely wouldn't include these identifiers from type helpers declared in sysutils. What is "special" about them, except they are declared in a rtl unit?