Duplicate keys in array literals?

Denis Shelomovskij verylonglogin.reg at gmail.com
Thu Nov 28 10:46:56 PST 2013


28.11.2013 15:23, bearophile пишет:
> Is it a good idea to silently statically accept duplicated keys in both
> dynamic array literals and in associative array literals?
>
>
> void main() {
>      int[]     a = [0:10, 0:20];
>      int[int] aa = [0:10, 0:20];
> }
>
>
> I don't remember having ever had the need for this, and on the other
> hand I have had some mistakes like this in my D code not caught
> statically by the compiler.
>
> -----------------------
>
> Note that in this post I am not discussing about inserting multiple
> times a key-pair in an associative array, this is normal and useful:
>
> void main() {
>      int[int] aa;
>      aa[0] = 10;
>      aa[0] = 20;
> }
>
> Bye,
> bearophile

File the issue please.

-- 
Денис В. Шеломовский
Denis V. Shelomovskij


More information about the Digitalmars-d mailing list