The following doesn`t work:

immutable(string[]) strArr = new string[](10);

But I feel that it probably should work. I know we have assumeUnique, but I remember awhile ago that some work was done toward making the result of unique expressions (like those using new) implicitly convertible to immutable, const, shared, etc. For example, the following works:

class Test
{
    int i;
}

immutable(Test) test = new Test();

(I realize that this will break if Test contains any non-value type like an array)

Reply via email to