Template Specialization - The HAC Language
Description: The HAC Language

Next: Partial Ordering of Specializations, Previous: Template Template Parameters, Up: Templates

### 9.7 Template Specialization

MAJOR PUNT.

Semantic contraint: The forward declaration of a general template must precede any declaration of any specialization with the same family (same name).

Also partial specializations.

See Template Definition Bindings, for the complicated issues regarding template specialization.

RESOLVE: Should we impose any restrictions on whether or not template definitions may be specialized, and if so, where?

For example: forcing all forward declarations of specializations for a particular definition family would solve the problem of specialization coherence, but would make such a family of definitions unextendable for future specializations – not all specializations can be declared up-front! Implementation consideration: For definition families consisting of only specializations (genericless), this can introduce a lot of overhead in having to process specializations irrelevant to a particular compilation unit.

Impose constraints on definitions, perhaps some invariant constraints and relations between generic and specialized definitions? (e.g. contains same named instances) But this would unnecessarily restrict variations in implementation of certain definitions.

Forward declarations of specializations.

RESOLVE: Do ports of specialized definitions have to match that of the generic template definition? Members certainly need not. What are the implications on argument type-checking?