The unfortunate thing about C++ templates in relation to the
polyinstantiation that languages like some ML dialects implement
(besides the unintelligible error messages, which are the deal breaker
for me) is that they really are compile-time code generation.  The
problem is that the template has to be /included/ in any using code.
This means that two compilation units that use minimum<int> will each
have their own instance of it.

It seems like it would be difficult to reason about how much
duplication would occur in a largeish project.  Worse, because you
can't put them into a library and have template parameters resolved at
link time, changes to templates require rebuilding all the code that
uses them.  It's a very inconvenient way to achieve code reuse IMHO.

William Leslie


Reply via email to