3.3 Type and Signature Declarations
type_ext_decl ::= "extend" "type" named_type {type_relation} ";"The syntax of object extension declarations is extended to support augmenting either just an object representation or both an representation and a type:
obj_ext_decl ::= "extend" extend_kind
named_object
{relation} [field_inits] ";"
extend_kind ::= "representation" extend representation
| ["object"] extend both type and representation
If the extension uses the representation
keyword, then the named representation is extended with the appropriate inheritance and conformance relations. Otherwise, both the representation and the type that are named by the extension are updated. A declaration of the form
is syntactic sugar for the following two declarations:extend object
nameinherits
namei1, namei2, ..., namein
subtypes
names1, names2, ..., namesm
isa
nameb1, nameb2, ..., namebk ;
It is an error if there does not exist both a representation and a type with the corresponding name.extend type
namesubtypes
names1, names2, ..., namesm, typeof(nameb1), typeof(nameb2), ..., typeof(namebk) ;extend representation
nameinherits
namei1, namei2, ..., namein, nameb1, nameb2, ..., namebksubtypes
name ;
Allowing types to be extended externally to have additional supertypes allows third-parties to integrate separately-developed libraries without modifying the separate libraries directly [Hölzle 93].
Generated with Harlequin WebMaker