Keywords

From The Oxygene Language Wiki

Jump to:navigation, search

This is a Language topic
Feel free to add your notes to this topic below.



Keywords, or reserved words, have a special meaning in the Delphi Prism language and cannot be used as names for Identifiers (but see Escaping Keywords below).

While in the Delphi Prism editor, place the cursor within a keyword and press F1 to invoke the appropriate help topic.


Full Keywords

The following words act as keywords on a global scope and regardless of context:

Keywords:


Conditional Keywords

The following are only keywords in a particular context (e.g. 'has' acts as a keyword within a 'where' clause of a generic constructor). The word "array" is only treated as a keyword when followed by "of" or by a square bracket. In all other contexts, it may be used freely as an identifier (for example to refer to the System.Array type). The same applies to "sequence".

Outside of their specific context, these words may be freely used as identifiers, although their use as such is discouraged, to avoid later conflicts if the identifier in question needs to be used in a conflicting context.

Keywords:


Conditional Keywords for Query Expressions

The following are only keywords in the context of Query Expressions:

Keywords:


Legacy Keywords

"Create" acts as a keyword, if the compiler option for Legacy Create Constructors is enabled.

Compiler Magic Functions

Although not keywords as such, Delphi Prism provides a list of so called Compiler Magic Functions. Please refer to the separate topic for reference.


Escaping Keywords

Sometimes Delphi Prism keywords conflict with existing types of members you want to use in your code (or even with names you decided to use yourself). Two commonly encountered examples are the "System.Type" and "System.Reflection.Assembly" types.

There are two ways to escape keywords and allow their use as identifiers:

  1. Identifiers can be prefixed with an ampersand, such as var lAssembly: &Assembly;. This ampersand will not be considered part of the name, it's just used to escape the use of the keyword.
  2. Keywords can be used as identifiers without explicit escaping, when following the period operator, such as: var lAssembly: System.Assembly;. The only exception is the Create keyword, if Legacy Create Constructors are enabled.


Oxygene-48.png

Area: Oxygene Language
Compiler version: Oxygene 5

Language GlossaryKeywordsTypesFAQHow To

Navigation
Areas
More
Toolbox