Library standardization -> template hiding suggestion !

Edward Diener eddielee_no_spam_here at tropicsoft.com
Sun Apr 20 18:10:33 PDT 2008


Don Clugston wrote:
> Edward Diener Wrote:
>> As a user of libraries largely based on templates, whether C++ or D, 
>> once I have faith in the quality of the library I feel I have no need to 
>> look at the source code in order to use it successfully and the actual 
>> template declarations should be enough, from the user's point of view, 
>> to interact with the library. Unfortunately in C++ and D this is not the 
>> case due to the way templates are currently implemented. But I think it 
>> could be the case if D pursued the line of thought that the end user of 
>> the template code, as opposed to the compiler itself, really has no need 
>> to interact with the template definition, as opposed to the template 
>> declaration, in order to use the template successfully.
> 
> You can always follow the example of Microsoft (who seem to have embraced the open-source concept in .NET???? <g> -- it's trivially decompileable) -- run the template code through an obfustcator before distribution.

No obfuscator, which the D compiler must be able to read as source, is 
going to hide the source more than very trivially.

> 
> CTFE is more interesting. I think we'll see far fewer uses of templates in D than C++; frequently, CTFE will be used instead. And it's easier to imagine CTFE being compiled, than templates being compiled.

Fair enough, but as I understand it CTFE currently must deal with known 
values at compile time. Templates normally execute at run-time when 
values are created by the template code. I may be wrong but I doubt that 
templates can all be subsumed by CTFE.



More information about the Digitalmars-d mailing list