Language Elements and Reference:xpplrm

Declarations Foundation

Declarations are used to associate a program element with a symbolic name or identifier. Declarations define identifiers for variables. They also identify to the compiler a section of code as a function, procedure, class or method. Declarations cause no operations.

In the case of variables, declarations also specify the variable type (whether it is a lexical or dynamic memory variable) and whether the compiler is to reference a field variable using the identifier.

When an identifier is declared for a section of the program, this section of the program runs whenever the identifier is used in program code.

Declarations appear in program code as statements starting with keywords. The keywords for declarations are listed in the following table:

Keywords for declarations
Declaration Description
STATIC Define visibility of program sections and lifetime of lexical variables
LOCAL Define visibility and lifetime of lexical variables
PROCEDURE Declare section of code as a procedure
FUNCTION Declare user-defined function (UDF)
MEMVAR Declare identifier for dynamic memory variable
FIELD Declare identifier for field variable
CLASS Declare class function and commence class declaration
VAR Declare identifier for instance variable
CLASS VAR Declare identifier for class variable
METHOD Declare identifier for instance method
CLASS METHOD Declare identifier for class method
ENDCLASS End of class declaration
METHOD Declare identifier for the program code of an instance method
CLASS METHOD Declare identifier for the program code of a class method
PARAMETERS Create parameters as variables of the PRIVATE type
PRIVATE Create dynamic memory variable of the PRIVATE type
PUBLIC Create dynamic memory variable of the PUBLIC type

A detailed description of these declarations is found in the reference documentation about "Class declaration".

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.