Forward Declaring Properties
Properties can be forward declared using the Register_Procedure and Register_Function statements. Forward declaring allows you to reference a property in some method before it is formally declared. The compiler would generate an error if you tried to do this without a forward declaration.
The syntax for forward declaring a property is:
Register_Procedure {property-name} Set {type} {param}
Register_Function {property-name} Returns {type}
Where:
- {property-name} is the name of the property that you are forward declaring.
- {type} is the data type of the property.
- {param} can be any variable identifier (note that {param} is not used).
The Register_Procedure part of the forward declaration is needed when you are forward referencing a property in a Set statement. The Register_Function part of the forward declaration is needed when you are forward referencing a property in a Get statement. If you only have one type of forward reference, then you can omit the unused part of the forward declaration.
Examples of Forward Declaring Properties
Register_Procedure Set Height Integer iX
Register_Function Height Returns Integer
Register_Procedure Set Width Integer iY
Register_Function Width Returns Integer
The above example would allow you to reference the registered properties inside the body of some method declaration even though the properties' own formal declarations have not yet been made.