assoc array initialization like in php
Anders F Björklund
afb at algonet.se
Mon Feb 20 14:30:24 PST 2006
nick wrote:
>>For now, you need to use explicit initializers instead:
>> int test[char[]];
>> test["test"] = 1;
>> test["bla"] = 2;
>> test["blub"] = 3;
>
> You know, this syntax looks almost as good as the proposed ones. Perhaps
> no change in necessary.
Just like in Java, it gets a little uglier when it's a "global":
int test[char[]];
static this()
{
test["test"] = 1;
test["bla"] = 2;
test["blub"] = 3;
}
But having array/map literals, doesn't change this "old" syntax ?
--anders
More information about the Digitalmars-d
mailing list