virtual types (Z.100)

A type being defined locally to a type definition (enclosing type) may be specified to be a virtual type. Block types, process types, service types, and procedures may be specified as virtual types. A virtual type may be constrained by another type of the same entity kind and it may be redefined in subtypes of its enclosing type.

<virtuality>::= virtual | redefined | finalized

<virtuality constraint> ::= atleast <identifier>

A virtual type and its constraint cannot have context parameters.

A virtual type may be constrained by the type identified by the <identifier> following the keyword atleast ;. This <identifier> must identify a type definition of the same entity kind as the virtual type. If <virtuality constraint> is omitted, it corresponds to specifying the virtual type itself as the constraint.

If <virtuality> is present in both the reference and the referenced definition, then they must be equal. If <procedure preamble> is present in both procedure reference and in the referenced procedure definition they must be equal.

A virtual type must have <virtuality> in its definition.

A virtual type must have the same formal parameters, gates and signals on its gates as its constraint.

Semantics

A virtual type may be redefined in the definition of a subtype of the enclosing type of the virtual type. In the subtype it is the definition from the subtype that defines the type of instances of the virtual type, also when applying the virtual type in parts of the subtype inherited from the supertype. A virtual type that is not redefined in a subtype definition has the definition as given in the supertype definition.

Accessing a virtual type by means of a qualifier denoting one of the supertypes implies, however, the application of the (re)definition of the virtual type given in the actual supertype denoted by the qualifier. A type (T) whose name is hidden in an enclosing subtype by a redefinition (of T) can be made visible through qualification with a supertype name (i.e. a type name in the inheritance chain). The qualifier will consist of only one path item denoting the particular supertype, or in the case of accessing a hidden type from a substructure of the supertype, the qualifier will consist of two path items, the first one denoting the block type and the second one denoting the substructure.

Both in the enclosing type definition and in any subtype of the enclosing type, the virtual type definition must be a specialization of its constraint. In a specialization of the enclosing type, a new definition of the virtual type is given by a type definition with the same name and with the keyword redefined;. A redefined virtual type is still a virtual type. The keyword finalized; instead of redefined; indicates that the type is not virtual, and it may thus not be given new definitions in further subtype redefinitions.

A virtual type with an explicit constraint but without an explicit inheritance implicitly inherits from the constraint type.

A redefined or finalized type without an explicit constraint and without an explicit inheritance implicitly inherits from the constraint of the corresponding virtual type.

A subtype of a virtual type is a subtype of the original virtual type and not of a possible redefinition.