> > For the declaration: > > uint[string] mywords = [ "Hello" : 1, "World" : 1, > > "Cat" : 1, "Dog" : 1 ]; > > > > > > I get: > > > > $ dmd test_01.d > > test_01.d(3): Error: non-constant expression > > ["Hello":1u,"World":1u,"Cat":1u,"Dog":1u]
> AAs can't be assigned to at compile time (:[). You'll have to use a > static constructor or an initiliasation function to assign to one at > global scope. thanks Bernard. I see, so for global associative arrays, I can't do it. That's good to know, and I guess that will force me into better coding habits. Anyways, I just wish the compiler could give me a better message than what I got. :( So, I moved the initialization to inside the main function, and now it works. Great. I think we need to put this question in the FAQ. Many thanks.