4.2. Control Structures

Figure 4.2. 

Loop expression

Constraints :

Returned Type :

In the literature 3 solution are defined for the return value of a loop expression:

Among these solution, and for the sake of simplicity, we have chosen to implement the first solution in KerMeta.

Expression

Type

Loop

result := kermeta::standard::Void

Block expression

A block is contains a set of statements and a set of rescue block. Each rescue block handles a particular type of exception. The type of an exception can only be a Class.

Constraints :

Returned Type :

Two alternatives exists in the literature :

In KerMeta we have chosen the second solution because it is the choice made in the OCL. If a rescue block is executed, the block expression returns Void.

Expression

Type

Block

TypeOf( Block.statement.last )

Conditional expression

Constraints :

Returned Type :

2 solutions

The first solution 1 has been rejected because it does not allow some very convenient OCL-like expressions.

Expression

Type

Conditional

UNION ( TypeOf( Conditional.thenBody ), TypeOf( Conditional.elseBody ) )