Suggestion: arrays.

jmh530 via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 11 07:44:04 PDT 2015


On Tuesday, 11 August 2015 at 09:08:57 UTC, John Colvin wrote:
>
> 2 choices:
> 1) break people's code and documentation by renaming .dup on 
> static arrays
> 2) have 2 equivalent names for the same thing
>
> Neither is likely to happen.
>
> If you want it for your own code:
>
> T[] dyn(T, size_t n)(T[n] a)
> {
>     return a.dup;
> }

The OP could also make it a property to make it even more 
similar. Perhaps the least amount of work would be if alias 
worked on functions (I don't see anything in the docs about that).

The broader issue that it is very easy to mix up static and 
dynamic arrays remains.


More information about the Digitalmars-d mailing list