Skip to main content
Version: 7.0

{...} 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

  • actionOperator

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

  • NESTED

    A keyword that marks the local property as nested. Without additional modifiers, the property is treated as nested both when crossed by NEWSESSION and during APPLY / CANCEL. Same semantics as in the DATA operator.

  • MANAGESESSION | NOMANAGESESSION

    Keywords that can only be used after NESTED.

    • MANAGESESSION means the property is treated as nested only for APPLY / CANCEL.
    • NOMANAGESESSION means the property is treated as nested only when crossed by NEWSESSION.
  • name1, ..., nameN

    A list of names of the local properties being created. The names are defined by simple ID's.

  • returnClass

    The class ID of the returned value of the local property.

  • argumentClass1, ..., argumentClassN

    A 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);
}