Object variables

Description

Object variables are used to store values of object types, each of which either identifies an instance of an object described by the object type or is the built-in constant nil which is guaranteed not to reference any instance of an object.

Currently the only supported object types are: the built-in object types connection and recordset, and the generic object type.

Object instances are called instance variables and are described in more detail in the next section.

Instance Variables

Instance variables contain the function and procedure methods, and properties defined by their object type. Function and procedure methods define the operations that can be perfomed on and by instance variables, and can be called anywhere a normal function or procedure can be called. Properties define the data (or at least the visible data) contained in the instance variables, and be referenced anywhere normal variables can be referenced.

In the case of object variables of the built-in object types connection and recordset, instance variables are created by calling the built-in procedure new, and passing the object variable as a parameter.

In the case of object variables of the generic object type, instance variables are created by calling the built-in function createobject, and passing the name of a COM object as a parameter.

In all cases, instance variables are destroyed by calling the built-in procedure dispose, and passing the object variable, that was used to create the instance variable, as a parameter.

Syntax

The syntax of referencing function and procedure methods, and properties is given below:

(NOTE: for clarity some parts of the syntax are omitted, see Irie Pascal Grammar for the full syntax):

   function-method-designator = object-variable '.' function-method-identifier [ actual-parameter-list ]

   procedure-method-statement = procedure-method-specifier [ actual-parameter-list ]

   property-designator = object-variable '.' property-specifier

   actual-parameter = expression | variable-access |
       procedure-identifier | function-identifier

   actual-parameter-list = '(' actual-parameter { ',' actual-parameter } ')'

   function-method-identifier = identifier

   object-variable = variable-access

   procedure-method-identifier = identifier

   procedure-method-specifier = object-variable '.' procedure-method-identifier

   property-identifier = identifier

   property-specifier = property-identifier | '(' property-string ')'

   property-string = string-expression

where object-variable is a reference to an object variable and property-string is an expression, of string type, that evaluates to the name of the property being referenced.