Should binary sharing be done using Mixin Template?

JimBob jim at bob.com
Sun May 22 07:12:17 PDT 2011


"Jonathan M Davis" <jmdavisProg at gmx.com> wrote in message 
news:mailman.306.1305975846.14074.digitalmars-d at puremagic.com...
> Templates are completely different from generics. Generics are 
> compile-time
> artifacts only and have no effect on the final binary. Templates, on the 
> other
> hand, are generated for each type that they're instantiated with. They are
> code generation, pure and simple. And since each and every instantiation 
> could
> be very different depending on what was done with static if and other 
> compile-
> time stuff which can affect code generation. So, if you had a
> LinkedList<Account> and a LinkedList<string>, their internal 
> implementation
> could be completely different if the writer of LinkedList thought that it 
> was
> appropriate to do so for whatever reason.

Cant the compiler simply do a bitwise compare of all versions of a given 
template function/method, and remove any that have duplicate code? I mean 
actually compare the generated asm code.








More information about the Digitalmars-d mailing list