missing __traits(isArray, T)? what's the difference between __traits & std.traits? can we remove one to avoid dup?

mw mingwu at gmail.com
Sun Jun 6 01:17:23 UTC 2021


On Sunday, 6 June 2021 at 01:06:26 UTC, Paul Backus wrote:
> On Sunday, 6 June 2021 at 00:52:32 UTC, mw wrote:
>> I read both can be used at compile time, I'm wondering is 
>> there any difference between __traits & std.traits?
>>
>> If there is no difference between this two mechanisms, should 
>> we completely move all the `__traits` stuff into std.traits to 
>> avoid duplication?
>
> `__traits` expressions are compiler builtins. The templates in 
> `std.traits` are library code. They might be implemented using 
> `__traits`, or `is(...)` expressions, or some other kind of 
> introspection. In general, it's not possible to move `__traits` 
> expressions into library code, because, as compiler builtins, 
> they're able to do things that can't be done any other way.


Thanks for the explanation, then can we at least remove the 
duplicates from the library? e.g.

https://dlang.org/phobos/std_traits.html#isStaticArray

https://dlang.org/spec/traits.html#isStaticArray


More information about the Digitalmars-d mailing list