std.traits vcs __traits

Bauss via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 16 05:05:54 PST 2017


On Monday, 16 January 2017 at 11:54:23 UTC, Stefan Koch wrote:
> On Sunday, 15 January 2017 at 12:53:04 UTC, Nordlöw wrote:
>> Why is there both
>>
>> http://dlang.org/phobos/std_traits.html
>>
>> and the builtin
>>
>> https://dlang.org/spec/traits.html
>>
>> ?
>>
>> Should we modify std.traits to make use of __traits? I've 
>> noticed measurably faster compilations with __traits instead 
>> of std.traits for simple things such as isIntegral, 
>> isUnsigned, etc.
>>
>> If so, I'll happily make that happen!
>
> There is a simple reason, you don't want complicated 
> type-introspection logic welded into the compiler.
>
> The reason why std.traits it slow is because of inefficiencies 
> inside the template-system, which I intend to fix.
> Therefore your efforts would be wasted.

I believe it still makes sense, since the logic need not to be 
applied both in the standard library and the compiler, when the 
compiler can deliver the information to the standard library, the 
standard library should use that information and at most wrap 
around it, not attempt to create an identical logic to that of 
the compiler.


More information about the Digitalmars-d mailing list