On Friday, 11 July 2014 at 20:02:32 UTC, Weasel wrote:
Why does the s1 not throw an error, but the a1 does?

Strings don't allocate upon use whereas all other arrays do unless you specifically mark it as static - immutability isn't considered here (I think because the part of the compiler that looks at the array literal doesn't look at the type on the left hand side so it just doesn't know but i'm not sure about why).

But if you make the immutable other array static it shouldn't GC allocate.

Reply via email to