Ad/2010-08-01 Concrete Syntax for a uml action Language for Foundational uml (Alf) Second Revised Submission



Download 1.74 Mb.
Page15/62
Date28.01.2017
Size1.74 Mb.
#9041
1   ...   11   12   13   14   15   16   17   18   ...   62

8.3.7Invocation Expressions


An invocation expression is used to invoke a behavior, either directly by name or indirectly by calling an operation or sending a signal. An invocation expression consists of a target, which may be a behavior name, a behavioral feature reference or a super reference, and a tuple, which provides actual arguments for any parameters of the invoked behavior or behavioral feature.

Syntax

InvocationExpression(e: InvocationExpression)
= InvocationTarget(e) Tuple(e.tuple)


InvocationTarget(e: InvocationExpression)
= BehaviorInvocationTarget(e)
| FeatureInvocationTarget(e)
| SuperInvocationTarget(e)


Figure 8 8 Abstract Syntax of Invocation Expressions



Cross References

  1. Expression see Subclause 8.1

  2. Tuple see Subclause 8.3.8

  3. BehaviorInvocationTarget see Subclause 8.3.9

  4. FeatureInvocationTarget see Subclause 8.3.10

  5. SuperInvocationTarget see Subclause 8.3.11

Semantics

For each type of invocation expression, the target potentially specifies a set of parameters for which actual arguments need to be provided in the invocation. For in parameters, the argument is a value that is assigned to the corresponding parameter. For inout and out parameters, the argument must be an expression of the form that is legal on the left hand side of an assignment (see Subclause 8.8 on assignments).

An invocation expression may assign to names that are used as arguments for out or inout parameters. This is discussed as part of the semantics for tuples (see Subclause 8.3.8). The assigned source for a name after the invocation expression is the same as the assigned source after the tuple.

For a synchronous behavior or operation call, if the invoked behavior has a return parameter, then the values on that parameter at the completion of the invocation provide the result of the invocation expression. Otherwise the invocation expression produces no result values.

Specific semantics for each kind of invocation expression are further discussed in Subclauses 8.3.9 to 8.3.11.

8.3.8Tuples


A tuple is a list of expressions used to provide the arguments for an invocation. There are two kinds of tuples, positional tuples and named tuples. In a positional tuple, the arguments are matched to the parameters in order, by position. A named tuple, on the other hand, includes an explicit identification of the name of the parameter corresponding to each argument.

NOTE. The sequence operation expression notation is not available at the minimum conformance level (see Subclause 2.1).

Syntax

Tuple(t: Tuple)
= PositionalTuple(t)
| NamedTuple(t)

PositionalTuple(t: PositionalTuple)
= "(" [ TupleExpressionList(t) ] ")"


TupleExpressionList(t: PositionalTuple)
= Expression(t.expression) { "," Expression(t.expression) }

NamedTuple(t: NamedTuple)


= "(" NamedExpression(t.namedExpression)
{ "," NamedExpression(t.namedExpression) } ")"

NamedExpression(n: NamedExpression)


= Name(n.name) "=>" Expression(n.expression)

Figure 8 9 Abstract Syntax of Tuples



Cross References

  1. Name see Subclause 7.5

  2. Expression see Subclause 8.1

  3. InvocationExpression see Subclause 8.3.7

Semantics

A tuple is evaluated by evaluating each of its constituent expressions concurrently. For arguments of in and inout parameters, the argument expression is fully evaluated to a value. For arguments of out parameters, the constituent parts of the argument expression are evaluated as if for the left hand side of an assignment (see Subclause 8.8).



NOTE. Since the argument expressions in a tuple are evaluated concurrently, they should not have side effects that influence each other’s evaluation.

Arguments

In a positional tuple, each argument expression corresponds, in order, to a parameter for the invocation in which the tuple is used.

In a named tuple, the argument names must be parameter names for the invocation in which the tuple is used. The arguments may appear in any order, but a parameter name may appear at most once in the tuple, and every non-optional parameter (i.e., having multiplicity lower bound greater than zero) of a target must be named in the invocation of that target.

A tuple may have fewer argument expressions than parameters. For a positional tuple, the unmatched parameters are those sequentially after the ones matched by the given argument expressions. For a named tuple, the unmatched parameters are those that are not named. An unmatched parameter must have mode out or have a multiplicity lower bound of 0.

For example, consider an activity with the following signature:

activity A(in x: Integer, in y: Boolean[0..1])

The following is then an invocation of this activity with a positional tuple:

A(1, true)

In this case, the argument 1 corresponds to the parameter x and the argument true corresponds to the parameter y. This is equivalent to the invocation with the named tuple:

A(x=>1, y=>true)

However, with a named tuple, the order of the arguments may be changed:

A(y=>true, x=>1)

Further, since the parameter y is optional (multiplicity lower bound of 0), no argument needs to be provided for it at all in the named tuple notation. For example, the following invocation using a named tuple:

A(x=>1)

is equivalent to the following invocation using a position tuple:



A(1)

which is in turn equivalent to:

A(1, null)

Assignment

Tuples with arguments corresponding to inout or out parameters act as assignments. The expressions corresponding to such parameters must have the form of the left hand side of an assignment (see Subclause 8.8), that is, either a local name or an attribute reference, possibly indexed. The assigned source for a name after the argument expression is determined as for the left hand side of an assignment, with the parameter as its assigned expression.

An argument expression for an inout parameter must also meet the static semantics of a name expression (see Subclause 8.3.3) or property access expression (see Subclause 8.3.6), if it is not index, or a sequence access expression (see Subclause 8.3.16), if it is indexed, but the argument expression for an out parameter does not. Thus, a local name used as the argument for an out parameter does not have to have an assigned source before the tuple, and a local name without a previous assigned source is considered to be newly defined with the same type and multiplicity as the out parameter.

A name may be assigned in at most one argument expression of a tuple. If there is one such argument expression, then the assigned source for the name after the tuple is the assigned source for the name after that argument expression. Otherwise the assigned source after the tuple is the same as before the tuple.

The result of an assignment to a name in one argument expression will not be used in other argument expressions. New local names defined in one argument expression cannot be used in another.



NOTE. This rule allows the argument expressions in a tuple to be evaluated concurrently.


Download 1.74 Mb.

Share with your friends:
1   ...   11   12   13   14   15   16   17   18   ...   62




The database is protected by copyright ©ininet.org 2024
send message

    Main page