[Issue 4703] Ambiguously designed array syntax

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 21 13:36:41 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4703



--- Comment #5 from bearophile_hugs at eml.cc 2010-08-21 13:36:39 PDT ---
I agree that this syntax is not very useful, and it may be considered for
removal:
int[] dict = [1:2, 3:4, 5:6];


> This ferature is in C99, with different syntax.
> [...] made it an mostly meaningless, obscure feature.

In D there is other syntax that is left from C or adapted from C that gives
problems:

enum string[5] data = ["green", "magenta", "blue" "red", "yellow"];
static assert(data[4] == "yellow"); // asserts
void main() {
    string s(); // what is this?
    int x1 = 066; // octal
    double[2] a = [1.0, 2.0];
    double[2] b = [3.0, 4.0];
    double[2] c[] = a[] + b[]; // silly error
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list