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

4.1 Explicit Parameterization

4.1.2 Instantiating Parameterized Declarations

A parameterized entity is not a first-class entity that can be manipulated directly, but rather it is an "entity generator:" a function from a tuple of types to an (instantiated) entity. To use a parameterized entity, a client must first instantiate it with actual types for each of its parameters, at which point the instantiated entity can be used as if it were a regular unparameterized entity where the formal type parameters have been replaced with the actual type parameters. The syntax of object references, type references, and messages is extended as follows to allow instantiating parameters to be provided:

named_object	::=	name [params]
named_type	::=	name [params]
message	::=	msg_name [params] "(" [exprs] ")"
dot_msg	::=	dot_expr "." msg_name [params] ["(" [exprs] ")"]
params	::=	"[" types "]"
All instantiations of a parameterized entity with the same actual parameter types name the same instantiated entity; e.g. two distinct static occurrences of array[int] name the same instantiated object. This semantics is a form of structural type equivalence, patterned after CLU and Trellis, and contrasts with some other languages where parameterized entities must be instantiated explicitly and given names before they can be used by client code.


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

Generated with Harlequin WebMaker