[Next] [Previous] [Up] [Top] [Contents] [Index]
3.4 Special Types and Type Constructors
The greatest lower bound of two types is notated with the following syntax:
glb_type ::= type "&" type
The 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 & type2
is a different type than the type introduced by the declaration
type type3 subtypes type1, type2;
The type 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:
type type4 subtypes type1, type2;
The type 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.
[Next] [Previous] [Up] [Top] [Contents] [Index]
Generated with Harlequin WebMaker