Generic code: @autoconst, @autopure, @autonothrow

Rainer Deyke rainerd at eldwood.com
Sun Aug 29 02:00:58 PDT 2010


On 8/29/2010 00:32, Jonathan M Davis wrote:
> Templates are instantiated when you use them. They can't work any other way. 
> Normal functions are instantiated where they are declared. Unless you want to 
> try and make it so that _all_ functions are instantiated where they are used 
> (which IMHO seems like a really _bad_ idea), templates are and must be treated 
> differently.

Why would that be a bad idea?

You gain:
  - Consistency.
  - The ability to treat all libraries as "header-only", with no
separate compilation.
  - Because there is no separate compilation, templated virtual
functions.  (Funny how that works out.)
  - Better global optimizations.

You lose:
  - Binary libraries.  (Which barely work anyway, because most of my
functions are already templated.)
  - Potentially some (or even a lot of) compilation speed, and
potentially not.  Separate compilation introduces its own slow-downs.


-- 
Rainer Deyke - rainerd at eldwood.com


More information about the Digitalmars-d mailing list