{...} operator
The {...} operator creates actions that executes a sequence of other actions.
Syntax
{
operator1
...
operatorN
}
Operators can be of two types:
actionOperator
LOCAL [NESTED [MANAGESESSION | NOMANAGESESSION]] name1, ..., nameN = returnClass (paramClass1, ..., paramClassN)
Description
A sequence of action operators and LOCAL operators enclosed in braces creates a new action that sequentially executes specified actions and creates specified local properties. The area of visibility of the local properties created inside the {...} operator ends at the end of this operator.
Parameters
-
actionOperatorA context-dependent action operator. Each operator is followed by a semicolon, except for operators ending in a closing brace. Extra semicolons are not an error.
-
NESTEDA keyword that marks the local property as nested. Without additional modifiers, the property is treated as nested both when crossed by
NEWSESSIONand duringAPPLY/CANCEL. Same semantics as in theDATAoperator. -
MANAGESESSION|NOMANAGESESSIONKeywords that can only be used after
NESTED.MANAGESESSIONmeans the property is treated as nested only forAPPLY/CANCEL.NOMANAGESESSIONmeans the property is treated as nested only when crossed byNEWSESSION.
-
name1, ..., nameNA list of names of the local properties being created. The names are defined by simple ID's.
-
returnClassThe class ID of the returned value of the local property.
-
argumentClass1, ..., argumentClassNA list of argument class ID's of the local property.
Examples
CLASS Currency;
name = DATA STRING[30] (Currency);
code = DATA INTEGER (Currency);
CLASS Order;
currency = DATA Currency (Order);
customer = DATA STRING[100] (Order);
copy 'Copy' (Order old) {
NEW new = Order { // an action is created that consists of the sequential execution of two actions
currency(new) <- currency(old); // a semicolon is put after each statement
customer(new) <- customer(old);
} // there is no semicolon in this line, because the operator ends in }
}
loadDefaultCurrency(ISTRING[30] name, INTEGER code) {
NEW c = Currency {
name(c) <- name;
code(c) <- code;
}
}
run () {
loadDefaultCurrency('USD', 866);
loadDefaultCurrency('EUR', 1251);
}