next up previous
Next: Predefined Classes Up: ODL: Language Report Previous: Inheritance

Parameterization

Classes, operations, and records may be paramaterized with one or more class arguments in brackets appended to the declared name. They may then appear inside the declaration anywhere an ordinary type could appear. A parameterized entity simultaneously defines all possible specializations of that entity. The specializations are themselves ordinary classes, operations, and records, subject to normal use. Parameterized classes may be defined as subclasses of other parameterized classes.

Translators must generate specializations for all versions that are actually used in a program. They may generate others as well; for example, those used in possible but untaken computation paths. Because they remain controversial, ODL does not support kinds (types of types). There are no type constraints on type arguments. However, translators must detect and report errors when expansions result in specializations that contain (nonparameterized) type errors. Since instantiation is static, first-order type rules are maintained for all specializations used in a program.


Doug Lea@Sat Apr 8 10:25:42 EDT 1995