--- Comment #6 from Jonathan M Davis <> 2010-11-26 17:21:30 
PST ---
It's going to have to be able to do it for objects eventually. Yes, it's a
thorny problem, but it _can_ be done. The fact that it's a thorny problem is
the reason why it hasn't been done _yet_, but it will be done eventually.

What I gathered what you were saying is that you were looking for a way to have
a static constructor initialize static local variables. Doing that would break
scoping rules.

However, re-reading your initial comment, it looks like what you want to have
happen is for the compiler to effectively set up a static constructor within
the function automatically which is not visible to the programmer. The compiler
would simply be smart enough to know that

static string[string] map1 = ["bar" : "spam"];

translates to something like

static string[string] map1;
static this()
    string[string] map1_temp;
    map1_temp["bar"] = "spam";
    map1 = map1_temp;

That's not an entirely bad idea, but it seems to me that since CTFE has to be
fixed to be able to handle this situation anyway, we might as well just fix
CTFE rather than have the compiler special case this situation.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to