Declare statement (forward reference) (LotusScript® Language)
Declares a forward reference to a procedure (a function, sub, or property), allowing calls to a procedure that has not yet been defined.
Syntax
Declare [ Static ] [ Public | Private ] procType procName [ ( [ argList ] ) ] [ As returnType ]
Elements
Static
Optional. Specifies that the values of the procedure's local variables are saved between calls to the procedure.
If this keyword is present, it must also be present in the definition of the procedure.
Public | Private
Optional. Public indicates that the declared procedure is visible outside this module, for as long as the module is loaded. If this keyword is present, it must also be present in the definition of the procedure.
Private indicates that the declared procedure is visible only within this module. If this keyword is present, it must also be present in the definition of the procedure.
procType
One of the following four keyword phrases, to identify the kind of procedure:
Function Sub Property Get Property Set
procName
The name of a function, sub, or property. If procType is Function (a function is being declared), then procName can have a data type suffix character appended to declare the type of the function's return value.
argList
A comma-separated list of argument declarations for the procedure. The procedure must be a function or a sub (procType must be Function or Sub). The argument declarations must match the argument declarations in the function or sub definition exactly.
The syntax for each argument declaration is:
[ ByVal ] argument [ ( ) | List ] [ As type ]
ByVal means that argument is passed by value: that is, the value assigned to argument is a local copy of a value in memory, rather than a pointer to that value.
argument () is an array variable. argument List identifies argument as a list variable. Otherwise, argument can be a variable of any of the other data types that LotusScript® supports.
As dataType specifies the variable's data type. You can omit this clause and use a data type suffix character to declare the variable as one of the scalar data types. If you omit this clause and argument doesn't end in a data type suffix character (and isn't covered by an existing Deftype statement), its data type is Variant.
Enclose the entire list of argument declarations in parentheses.
returnType
The data type of the function's return value. This is optional for a function, and not allowed for a sub or a property, because they don't return values. returnType must match the return type specified in the function definition; no conversion is performed on the return value.
If you omit As returnType, the function name's data type suffix character appended to procName (the function name) determines the return value's type. Do not specify both a returnType and a data type suffix character.
If you omit As returnType and procName has no data type suffix character appended, the function returns a value either of data type Variant or of the data type specified by a Deftype statement.
Usage
The IDE implicitly generates forward declarations of procedures; directly entering them in the IDE is unnecessary and causes syntax errors. You can %Include a file containing forward declarationsof procedures contained in the file. You can directly enter in the IDE forward declarations of class properties and methods.
The Public keyword cannot be used in a product object script or %Include file in a product object script, except to declare class members. You must put such Public declarations in (Globals).
You can make a forward declaration only at the module level or within a class.
The procedure, if it exists, must be defined in the same scope as the forward declaration. LotusScript® does not generate an error if a procedure has a forward declaration but is not defined. (An error will be generated if you try to call a procedure that has been declared but not defined.)
A procedure declared within a class definition cannot be declared as Static.
The use of Static, Public, and Private keywords in a Property Get forward declaration must match their use in the corresponding Property Set forward declaration, if one exists.