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

Adam D. Ruppe destructionator at gmail.com
Sun Jun 6 01:06:01 UTC 2021


On Sunday, 6 June 2021 at 00:52:32 UTC, mw wrote:
> and want to try `__traits(isArray, T)` in my code, but the 
> compiler complains it's not there,

You can check is array with an is expression `is(T == E[], E)`.

> I read both can be used at compile time, I'm wondering is there 
> any difference between __traits & std.traits?

The original idea was that __traits would be the raw language 
built-in, then std.traits is the refined library interface.

std.traits uses some __traits, some is(), and some other 
miscellaneous techniques together under the hood.

tbh my personal view is to ditch std.traits and just teach people 
the pure language techniques.


More information about the Digitalmars-d mailing list