[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++

From: William Leslie
Subject: Re: C++
Date: Mon, 9 Nov 2009 22:56:29 +1100

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

[Prev in Thread] Current Thread [Next in Thread]