From dlang:


Static array properties are:
...
.dup Create a dynamic array of the same size and copy the contents of the array into it. .idup Create a dynamic array of the same size and copy the contents of the array into it. The copy is typed as being immutable.
...
Dynamic array properties are:
...
.dup Create a dynamic array of the same size and copy the contents of the array into it. .idup Create a dynamic array of the same size and copy the contents of the array into it. The copy is typed as being immutable. D 2.0 only
...
<<<

The problem:
'dup' is an abbreviation of 'duplicate'.
However, for static arrays, result is not a true duplicate of the source.
But, for dynamic arrays, result is a true duplicate.
So the same abbreviation produces two different effects.
Bugsource?

Suggested solution:
For static arrays, replace '.dup' with '.dyn' (and similarly for 'idup').
Use of 'dyn' would also add clarity.

Reply via email to