[Next] [Previous] [Up] [Top] [Contents] [Index]

4 Parameterization and Parametric Polymorphism

4.4 Implicit Type Parameters in Extension Declarations

An extension declaration can augment either an instance of a parameterized type or a collection of instances using an implicit type parameter. For example, the following declaration extends a single instance of a parameterized type:

extend array[char] subtypes string;
and the following declaration extends a collection of related types:

extend collection['T <= printable] isa printable;
To extend a parameterized type itself, not just some instances, an extension declaration that updates all instances is used:

extend list['T] subtypes variable_length_collection[T];

The Cecil Language: Specification and Rationale, Version 2.1 - 25 MARCH 1997
[Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with Harlequin WebMaker