toString refactor in druntime

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 3 01:47:57 PST 2014


On 11/3/14 8:45 AM, 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?

Probably about three times easier to read and write.

> 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).
> 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.
>
> 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 same argument goes for all statically linked libraries.

> 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.
>
> This argument could equally be applicable to phobos, and I've always
> been nervous about it too for the same reasons... but I'll draw a line
> there, in that phobos is not critical for an application to build and
> link, and so much of the API is already templates, it would be
> impossible to change that now.

Within reason, most of the runtime and standard library ought to be 
generic so as to adapt best to application needs. Generics are a very 
powerful mechanism for libraries.


Andrei



More information about the Digitalmars-d mailing list