Variables | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Variable Naming & Lookup |
Naming rulesVariable reference have the form ${Varname}. Variable names are case sensitive and may contain any valid character except a closing brace '}'.
Search AlgorithmWhen a variable reference is encountered, each object starting at the present object, its parent, its parent, and so on is asked if it can provide a definition for that variable. The first definition encountered is used. If no object can provide a definition, the global variable list is then searched in order. If more than one global variable is defined with the same name, the results are undefined.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Variable Errors |
The following conditions will trigger an error, and the variable reference
will return the string ERROR.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Variable Lookup Recursion |
Two types of variable recursion are permitted; this is one. If a variable expansion results in a string that contains another variable reference, variable expansion happens again on the new string until either no variable references are left, or a maximum replacement count is exceeded. For example, consider a Screenswitch class with a Screen Name that references a global variable ${MyScreen}. The Screenswitch contains a text object that references the variable ${ScreenName} (defined by Screenswitch). First, the text object expands ${ScreenName}, which results in the string ${MyScreen}. Then, ${MyScreen} is expanded to yield the value defined in the main variable list (or perhaps a parent object such as a template object). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Variable Name Recursion |
Two types of variable recursion are permitted; this is another. Recursion is permitted on variable names. Consider three variables, var1=Foo, var2=Bar, and variable FooBarXYZ=test. The reference ${${var1}${var2}XYZ} will yield the string test. Inner variables are expanded before outer.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Read-Only Global Variables |
Some global variables are read-only. In many cases their value will
change between expansions; for example, the amount of free memory.
Date & Time Variables (uses Locale settings)
Memory & Resource Variables
|