Hi to everynoe,
I am with my colleague Elena studying the union type and we have find a thing
in the standar we are not able to resolve. At page 39 of the Core Language
V3.2.1 is an example on how to declare and use an union type.
6.3.5.0 General
TTCN-3 supports the union type. The union type is a collection of fields, each
one identified by an identifier. Only
one of the specified fields will ever be present in an actual union value. Union
types are useful to model a structure
which can take one of a finite number of known types.
EXAMPLE:
type union MyUnionType
{
integer number,
charstring string
};
// A valid instantiation of MyUnionType would be
var MyUnionType age, oneYearOlder;
var integer ageInMonths;
age.number := 34; // value notation by referencing the field. Note, that this
// notation makes the given field to be the chosen one
oneYearOlder := {number := age.number+1};
ageInMonths := age.number * 12;
The value list notation for setting values shall not be used for values of union
types.
The instruction we do not understand is " oneYearOlder := {number :=
age.number+1}; ", because the last line of of the point 6.3.5.0 says the list
notation is not supported by a union type. Is the example incorrect?