toString refactor in druntime

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 3 01:55:51 PST 2014


On 11/2/2014 11:45 PM, Manu via Digitalmars-d wrote:
> On 2 November 2014 04:15, Walter Bright via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
>> Why would templates make you nervous? They're not C++ templates!
> What do you mean? How are D templates any different than C++ templates
> in a practical sense?

They're much more straightforward to use, syntactically and semantically.


> I want a binary lib to be a binary lib. I don't think it's good form
> for the lowest level library in the language ecosystem to depend on
> templates (ie, client-side code generation).

What's the problem with that?


> This is the fundamental lib that will be present in every D
> application there is. If it is not a binary lib, then it can't be
> updated.

Have you ever looked at the C openssl.lib? The .h files with it are loaded with 
metaprogramming done with C macros. Yet I've never heard anyone complain about 
it. C .h files for DLLs are typically stuffed with C macros.


> Consider performance improvements are made to druntime, which every
> application should enjoy. If the code is templates, then the old
> version at time of compiling is embedded into existing client
> software, the update will have no effect unless the client software is
> rebuilt.
> More important, what about security fixes in druntime... imagine a
> critical security problem in druntime (I bet there's lots!); if we
> can't update druntime, then *every* D application is an exploit. Very
> shaky foundation for an ecosystem...

The defense presents openssl as Exhibit A!

(The templates really only present the interface to the dll, not the guts of it.)


> druntime is a fundamental ecosystem library. It should be properly
> semantically version-ed, and particularly for security reasons, I
> think this should be taken very very seriously.

openssl!!!

BTW, you should know that if a template is instantiated by the library itself, 
the compiler won't re-instantiate it and insert that in the calling code. It'll 
just call the instantiated binary.



More information about the Digitalmars-d mailing list