On 1/24/11, BlazingWhitester <max.kl...@gmail.com> wrote:
> On 2011-01-24 17:45:03 +0200, Andrej Mitrovic said:
>
>> Is this a bug?
>>
>> import std.stdio;
>>
>> string[string] values = ["abc":"abc", "def":"def"];
>>
>> void main()
>> {
>>     string[string] values2 = ["abc":"abc", "def":"def"];
>> }
>>
>>
>> test.d(3): Error: non-constant expression ["abc":"abc","def":"def"]
>>
>> What's non-constant about that expression?
>
> It's because of D's implementation of AA, but you can make it work with
> enum, e.g. enum string[string] values = ["abc":"abc", "def":"def"]; //
> works just fine at compile time
>
>

It's interesting that enum works but immutable doesn't. enum will do, Thanks.

Reply via email to