[Issue 5279] Function-static associative arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 26 15:45:53 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5279



--- Comment #2 from bearophile_hugs at eml.cc 2010-11-26 15:44:29 PST ---
(In reply to comment #1)
> I would expect that this problem would be solved together with however being
> able to use Objects with CTFE and dynamic memory in general is solved. Since, I
> believe that it's essentially the same problem that won't allow you to
> initialize a global variable which is a class type to anything other than null.
> CTFE can't handle the heap yet. Once it can, AAs should work.

In DMD 2.050 this code works, so this enhancement request asks for those
foo_map* to be visible inside foo() only:


string[string] foo_map1;
const string[string] foo_map2;
immutable string[string] foo_map3;
static this() {
    foo_map1 = ["bar" : "spam"];
    foo_map2 = ["bar" : "spam"];
    foo_map3 = ["bar" : "spam"];
}
void foo() {
    // here use foo_map1, foo_map2, foo_map3
}
void main() {}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list