3.4 Special Types and Type Constructors
glb_type ::= type "&" typeThe type type1
&
type2 is a subtype of both type1 and type2, and a supertype of all types that are subtypes of both type1 and type2. Syntactically, the greatest-lower-bound type constructor has higher precedence than the least-upper-bound type constructor.Note that the greatest-lower-bound of two types is different than a named type that is a subtype of the two types. For example,
type1 & type2is a different type than the type introduced by the declaration
The typetype
type3subtypes
type1, type2;
type3
is a subtype of type1
&
type2
(all types that subtype both type1
and type2
are automatically subtypes of type1
&
type2
), but not identical to it. The reason is that the programmer might later define a type4
type:
The typetype
type4subtypes
type1, type2;
type4
is also a subtype of type1
&
type2
, but type3
and type4
are different and in fact mutually incomparable under the subtype relation. The two types are different because named types include implicit behavioral specifications, and the implication of the two separate type declarations is that the implied behavioral specifications of type3
and type4
are different.
The void
, any
, and none
special types and the greatest-lower-bound and least-upper-bound type constructors serve to extend the explicitly-declared type partial order generated from type and object declarations to a full lattice.
Generated with Harlequin WebMaker