Next: , Up: TC-4   [Contents][Index]


4.8.1 TC-4 Goals

Things to learn during this stage that you should remember:

Function template and member function templates

Functions template are quite convenient to factor code that looks alike but differs by the nature of its arguments. Member function templates are used to factor error handling the TypeChecker.

Virtual member function templates

You will be asked why there can be no such thing in C++.

Template specialization

Although quite different in nature, types and functions are processed in a similar fashion in a Tiger compiler: first one needs to visit the headers (to introduce the names in the scope, and to check that names are only defined once), and then to visit the bodies (to bind the names to actual values). We use templates and template specialization to factor this. See also the Template Method.

The Template Method design pattern

The Template Method allows to factor a generic algorithm, the steps of which are specific. This is what we use to type check function and type declarations. Do not confuse Template Method with member function template, the order matters. Remember that in English the noun is usually last, preceded by qualifier.

Type-checking

What it is, how to implement it.

Stack unwinding

What it means, and when the C++ standard requires it from the compiler.