4 Parameterization and Parametric Polymorphism
object declaration, the implied representation and type declarations are parameterized with the same formal type parameters. Similarly, when a method declaration is desugared, the implied implementation and signature declarations have the same explicit type parameters and formal argument types, including any implicit type parameter bindings. For example, the declarations
are syntactic sugar for the following declarations:abstract objectcollection[T];methodprint(c@:collection['T <= printable]):void {...}methodexpand_tabs(c@:'T <= collection[char]):T {...}abstractobjecttable[Key,Value]isacollection[Value];abstractobjectindexed[T]isatable[int,T];templateobjectarray[T]isaindexed[T];methodnew_array[T](size:int, initial_value:T):array[T] {...}
typecollection[T];abstract representationcollection[T]subtypescollection[T];signatureprint(collection['T <= printable]):void;implementationprint(c@:collection['T <= printable]):void {...}signatureexpand_tabs('T <= collection[char]):T;implementationexpand_tabs(c@:'T <= collection[char]):T {...}typetable[Key,Value]subtypescollection[Value];abstract representationtable[Key,Value]inheritscollection[Value]subtypestable[Key,Value];typeindexed[T]subtypestable[int,T];abstractrepresentationindexed[T]inheritstable[int,T]subtypesindexed[T];typearray[T]subtypesindexed[T];templaterepresentationarray[T]inheritsindexed[T]subtypesarray[T];signaturenew_array[T](int, T):array[T];implementationnew_array[T](size:int, initial_value:T):array[T] {...}
Generated with Harlequin WebMaker