__traits for checking if a type is dynamic array (slice)

Basile B. b2.temp at gmx.com
Mon Nov 26 09:28:37 UTC 2018


On Monday, 26 November 2018 at 09:04:25 UTC, Per Nordlöw wrote:
> Why is there no
>
> - __traits(isArray, T)
>
> alongside
>
> - __traits(isStaticArray, T) and
> - __traits(isAssociativeArray, T)
>
> when dmd already has `ENUMTY.Tarray` alongside
>
> - ENUMTY.Tsarray and
> - ENUMTY.Taarray
>
> and std.traits already has a wrapper for this at
>
> https://dlang.org/phobos/std_traits.html#isDynamicArray
>
> ?
>
> Should we add this new builtin trait and use it in 
> std.traits.isDynamicArray?
>
> If so, should we call it
>
> - __traits(isDynamicArray) or
> - __traits(isArray) or
> - __traits(isArraySlice) or
> - __traits(isSlice) or
>
> something else?

Yeah maybe just try, although i see some alias this implication 
in the current std.traits implementation. Adding a new trait is 
rarely a big deal as far as i could see in the past (i.e no big 
never endings discussions).


More information about the Digitalmars-d-learn mailing list