I need to have an object which is initialized only once, so I thought
I could use immutable for that. But I can't do this:

private class Foo {}
immutable Foo foo;

static this()
{
    foo = new Foo;
}

void main() {}

And I can't new the object when it's declared. Even if CTFE could new
objects, it wouldn't be possible because the ctor depends on API
calls.

Reply via email to