Weed wrote:
In fact, the D is not contain a mechanism for compile-time
initialization of objects. Maybe add?
void main()
{
    S a = S(8); // ok
    static S b = S(8); // error
}

You want syntactic sugar for two things:

// example 1
void foo ()
{
        static S s;
        static bool s_initialized = false;
        if (!s_initialized)
        {
                s_initialized = true;
                s = S(8);
        }
}

// example 2
// module/class level
S s;
static this ()
{
        s = S(8);
}


Neither of these need to happen at compile time.

Reply via email to