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

Paul Backus snarwin at gmail.com
Sun Jun 6 01:06:26 UTC 2021


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.


More information about the Digitalmars-d mailing list