Reply To: Creating Structured Data Types in OAL

homepage Forums BridgePoint/xtUML Usage and Training Creating Structured Data Types in OAL Reply To: Creating Structured Data Types in OAL

#5485
poj
Participant

Actually it is at least partially consistent, however it is strange.

Look at the case where you want to create a local variable in OAL:
[code title=””]
Var_A = <expression>
[/code]
the type of Var_A is derived from the type of the right hand expression. However, there are no “primitive” expression that can have a structure type.

For arrays in OAL, you can actually create an array in action code by assigning to the last item in the array:
[code title=””]
Var_B[17] = <expression>;
[/code]
Var_B is now an array of 18 elements, accessed from 0 to 17, however the “type” of Var_B can be seen as an anonymous type that is an array of the type of the expression. Looking at the meta-model, xtUML is actually lacking named types with dimensions. Only specific objects of a data type may have dimensions. In most cases this does not lead to any problems, but there are cases when mapping towards legacy code that is hard to handle without specific model compiler extensions.

It would be nice to have support for declaring the type of a variable properly. That would require adding constructs to OAL. One quick idea would be to fomulate that as
[code title=””]
declare Var_A as Type_Name;
declare Var_B as instance reference of Key_Letters
declare Var_C as instance reference set of Key_Letters
[/code]
The last variant is perhaps not so useful, since instance sets are lacking useful operations for modifying them.
The last two are used when needing to bring a variable name into a scope, and for the model interpretation and model compiler we use at work, we have defined that Var_B case is written as
[code title=””]
select any Var_B from instances of Key_Letters where (False);
[/code]
Literal false where clauses on select from instances of are special cased, and only results in bringing the variable into the correct scope.