CHOICE

The choice type is defines similarly to SET type with difference, that components act as alternatives. In other words, this type is a collection of values, which are all distinct and only one of them can be used at the same time.

The type notation is similar to all structured types. Let's have a structure, which alows us to substitute real or integer type into another structure:

Value notation is then slightly different, because it is needed to express which alternative is taken:

It is probably useless to use any subtyping for this type, but under special circumstances, it may be necessary. There is one special subtyping, but not pure, that's why it is called selection type. It is good to enhance readability, because it just define new type on basis of a type chosen from choice type. It uses special keyword <, which is placed between chosen component and type reference as in following example:

When including selection type into structure, it is possible to use original reference or override it by new one:

But one pure subtyping can be aplied on CHOICE-s - it is inner subtyping, both full and partial specifications:

Some recommendations on the end of this page. It is recommended to use CHOICE type also when only one alternative is taken at present time, but it is possible, that some alternatives will be added in the future.