Skip to content

Data

Context

A Context 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.

new Context {
  variables {
    new ContextVariable {...}...
  }
}
Listing 1: A ContextVariable construct (we use ... to denote a placeholder for construct keywords, or multiple instances of a construct).

Note

The value of a variable is defined through an expression.

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.

ContextVariable

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.

new ContextVariable {
  name = "variableName"
  value = "1"
}
Listing 2: A ContextVariable 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.

Rule

Within a scope, the name of a variable must be unique.

Info

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.

Info

Evaluation of a value expression is implementation-specific.

ContextVariableReference

A variable may be referenced through a variable reference.

new ContextVariableReference {
  reference = "photoPath"
}
Listing 3: A ContextVariableReference 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.

Rule

The variable reference must be an existing variable in scope.