On Wed, 23 Jun 2010 00:30:40 +0200, Ali Çehreli <acehr...@yahoo.com> wrote:
dcoder wrote:
> 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.
For future reference, if it really needs to be global:
uint[string] mywords;
static this()
{
mywords = [ "Hello" : 1, "World" : 1, "Cat" : 1, "Dog" : 1 ];
}
Ali
from what I have read in TDPL so far (about half way now), there is no
mention of this limitation.
It just says that [key:value] is how you would statically initialize a AA.
Does this mean that it is just a D implementation issue. To me its seems
like this should be a defined part
of the language. Also the compiler should really rewrite it to your above
code anyway, surely?
-Rory