assoc array initialization like in php
Anders F Björklund
afb at algonet.se
Mon Feb 20 03:05:34 PST 2006
dennis luehring wrote:
> in php you can init an assoc array
[...]
> can we have something equal to this in d?
It's on the D wishlist, along with array inits...
i.e.
int test[] = [ 1,2,3 ];
See http://www.digitalmars.com/d/archives/26695.html
Choosing a syntax would be a good thing, though ?
maybe:
int test[char[]] = [ "test": 1, "bla": 2, "blub": 3 ];
--anders
PS.
For now, you need to use explicit initializers instead:
int test[char[]];
test["test"] = 1;
test["bla"] = 2;
test["blub"] = 3;
More information about the Digitalmars-d
mailing list