Library standardization -> template hiding suggestion !
Bill Baxter
dnewsgroup at billbaxter.com
Sun Apr 20 16:49:28 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.
>
> 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.
Can you elaborate? Since CTFE funcs are essentially run by an
interpreter I don't see how you would handle pre-compilation of them
easily. Any easier than could be done with templates at least.
--bb
More information about the Digitalmars-d
mailing list