__traits for checking if a type is dynamic array (slice)
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.com
Mon Nov 26 14:02:15 UTC 2018
On 11/26/18 4:04 AM, Per Nordlöw wrote:
> Why is there no
>
> - __traits(isArray, T)
>
> alongside
>
> - __traits(isStaticArray, T) and
> - __traits(isAssociativeArray, T)
Thanks for bringing this to my attention, Per.
The core idea is to have __traits "primitive and ugly" and std.traits
"convenient and nice". From that viewpoint, if isArray can be
implemented as a library feature using primitives provided by traits,
there is no need for making it.
> when dmd already has `ENUMTY.Tarray` alongside
>
> - ENUMTY.Tsarray and
> - ENUMTY.Taarray
Justifying the feature by means of a detail in the compiler
implementation is definitely undesirable.
> and std.traits already has a wrapper for this at
>
> https://dlang.org/phobos/std_traits.html#isDynamicArray
>
> ?
If the wrapper works well, use it and move on.
Thanks,
Andrei
More information about the Digitalmars-d-learn
mailing list