In my program I have error with circular imports of modules with
static ctors. So I decided to move ctors in separate file and
import it only from the 1st file. But problem is that in the
first file I have immutables that should be initialized in shared
static ctor. However doing it from another module's ctor gives
compilation error: "Error: cannot modify immutable expression".
1. Is it a bug?
2. Could I solve this problem another way?
Example code:
module mod;
import mod_init;
static immutable string[string] aa;
...
--------------
module mod_init;
import mod;
shared static this
{
aa = [ "a": "b", "c": "d" ]; //This gives compilation error
}
...