Data-related constructs are described below.
Data
A Data construct is used to lexically declare data within a certain scope (see dynamic extent), data may be persistent, local, or static.
- Persistent data is available persistently throughout and possibly outside the collaborative state machine.
- Local data is restricted to a subset of components of the collaborative state machine.
- Static data is specific to states.
Listing 1: A Data construct (we use ... to denote a placeholder for construct keywords, or multiple instances of a construct).
The value of a variable is defined through an expression. In Listing 1, the integer value 1 is obtained from the string expression "1", which evaluates to the integer value.
The following keywords can/must be provided:
Keyword | Description | Type | Optional |
---|---|---|---|
variables | Collection of variables declaring data. | list of Variable | No |
variables
The variables keyword is used to declare variables. Their scope and lifetime are bound to the associated scope defined by the persistentData, localData, or staticData keyword.
Variable
A variable declares data, it does so by providing an expression that, when evaluated, results in a data value.
Whether a variable is in scope is dependent on how it is declared, see dynamic extent.
Listing 2: A Variable construct.
The following keywords can/must be provided:
Keyword | Description | Type | Optional |
---|---|---|---|
name | Name of the variable. | string | No |
value | Value expression. | Expression | No |
name
The name keyword specifies the name of the variable. It serves to reference the variable.
Within a scope, the name of a variable must be unique.
The validity of a variable name is implementation-specific.
value
The value keyword specifies the value expression of the variable. When evaluated, the value expression yields the variable's value.
Evaluation of a value expression is implementation-specific.
VariableReference
A variable may be referenced through a variable reference.
Listing 3: A VariableReference construct.
The following keywords can/must be provided:
Keyword | Description | Type | Optional |
---|---|---|---|
reference | Name of the referenced variable. | Variable.name | No |
reference
The reference keyword specifies the name of the variable that is referenced.
The variable reference must be an existing variable in scope.