February 20, 2009
I want to create an immutable global static array, which should be initialized in a static this() statement at program startup, or at compile time using CTFE.  This can be done for dynamic arrays, since an immutable array can be assigned to once in a static constructor, and can be returned from a CTFE function, but I don't see how to do it for a static array.  Basically I want something like this:

immutable ubyte[SOMECONSTANT] foo;
static this() {
    // Create array and assign it to foo, and then have foo be  immutable.
}

Or:

immutable ubyte[SOMECONSTANT] foo = someCTFEFunction(someArgument);