On Thu, 12 Nov 2009 14:46:29 -0500, Walter Bright
<[email protected]> wrote:
Don wrote:
Especially when it's creating an inconsistency with string literals.
The inconsistency bothers me, too, but then there's the case:
int x;
...
[1, 2, x]
That can't be made immutable. Shouldn't it work? There's no analog for
that for string literals, so the inconsistency isn't quite complete.
I thought so too, but I think Don is right. A library function can solve
that problem:
auto arr = array(1,2,x);
BTW, there is legitimate inconsistency here:
int[] x = [1,2,3]; // compiles and does what you expect
char[] str = "abc"; // should allocate a mutable string on the heap,
should it not?
-Steve