What's wrong with D's templates?
Walter Bright
newshound1 at digitalmars.com
Mon Dec 21 19:22:51 PST 2009
Kevin Bealer wrote:
> The performance / impl-hiding conflict is a fundamental problem -- if
> the user's compiler can't see the template method definitions, then
> it can't optimize them very well. If it can, then the user can too.
> Any method of compiling them that preserves enough info for the
> compiler to work with will probably be pretty easily and cleanly
> byte-code-decompilable.
Absolutely right.
One of the features that C++ exported templates was supposed to provide
was obfuscation of the template bodies so that users couldn't see it. My
contention was that there was essentially no reasonable method to ensure
that.
1. any obfuscation method only has to be cracked by one individual, then
everyone can see through it.
2. if you ship the library for multiple compilers, you only have to
crack the weakest one
3. if you provide the decryption key to the customer, and you must, and
an open source compiler is used, you lose
More information about the Digitalmars-d
mailing list