I need mutable storage for immutable associative array. Just create new immutable AA and store it for future passing it between threads/fibers.

First attempt: just immutable AA
immutable aa = ["1":1, "2":1];
aa = ["1":1, "2":1]; // fail, can't assign a new AA

Second attempt: mutable AA with immutable elements.
immutable (int)[string] aa = ["1":1, "2":1];
aa = ["1":1, "2":1]; // sucess!
aa["2"] = 2;         // doesn't compile, is AA immutable?
aa.remove("1"); // fail, this compiles, AA actually isn't immutable

Third attempt: Rebindable
Rebindable!(immutable int[string]) aa; // fail, Rebindable doesn't accept AAs

Reply via email to