Jump to page: 1 2
Thread overview
std.traits vcs __traits
Jan 15, 2017
Nordlöw
Jan 15, 2017
Jack Stouffer
Jan 15, 2017
Nordlöw
Jan 16, 2017
Bauss
Jan 16, 2017
Nordlöw
Jan 16, 2017
Bauss
Jan 17, 2017
Nordlöw
Jan 19, 2017
Nick Treleaven
Jan 16, 2017
Stefan Koch
Jan 16, 2017
Bauss
Jan 16, 2017
Jonathan M Davis
Jan 16, 2017
Stefan Koch
Jan 17, 2017
QAston
Jan 17, 2017
Jonathan M Davis
January 15, 2017
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!
January 15, 2017
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

Several reasons, including usability in meta-templates like allSatisfy and the fact that it's way more user friendly and clear as a template.

> Should we modify std.traits to make use of __traits?

If it's faster and passes all of the tests, then sure.
January 15, 2017
On Sunday, 15 January 2017 at 13:45:52 UTC, Jack Stouffer wrote:
> If it's faster and passes all of the tests, then sure.

Great!
January 16, 2017
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!

I thought it already did that. I hope this can be a thing so std.traits actually makes use of what's build-in, rather than attemtping to apply the same logic that arleady exist elsewhere.
January 16, 2017
On Monday, 16 January 2017 at 09:09:34 UTC, Bauss wrote:
> I thought it already did that. I hope this can be a thing so std.traits actually makes use of what's build-in, rather than attemtping to apply the same logic that arleady exist elsewhere.

That's exactly my plan.
January 16, 2017
On Monday, 16 January 2017 at 11:20:16 UTC, Nordlöw wrote:
> On Monday, 16 January 2017 at 09:09:34 UTC, Bauss wrote:
>> I thought it already did that. I hope this can be a thing so std.traits actually makes use of what's build-in, rather than attemtping to apply the same logic that arleady exist elsewhere.
>
> That's exactly my plan.

Thank you!
January 16, 2017
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.
January 16, 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.
January 16, 2017
On Monday, January 16, 2017 11:54:23 Stefan Koch via Digitalmars-d 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 can see that as an argument not to add something that it's in std.traits to __traits or why something should be added to std.traits rather than __traits, but if something already exists with __traits, why duplicate that logic in std.traits? It seems like it complicates std.traits for no benefit as well as risking having the behavior of  __traits and std.traits differ, which could cause confusion and bugs.

- Jonathan M Davis


January 16, 2017
On Monday, 16 January 2017 at 19:45:33 UTC, Jonathan M Davis wrote:

> I can see that as an argument not to add something that it's in std.traits to __traits or why something should be added to std.traits rather than __traits, but if something already exists with __traits, why duplicate that logic in std.traits? It seems like it complicates std.traits for no benefit as well as risking having the behavior of  __traits and std.traits differ, which could cause confusion and bugs.
>
> - Jonathan M Davis

Ah my bad, I thought nordlow was proposing implementing things as traits,
I did overlook that there are already __traits for that.

Well then Nordlow go ahead an transform the relevant phobos-traits.
to make use of __traits.

« First   ‹ Prev
1 2