On 25.01.2011 00:22, Robert Clipsham wrote:
If you append something mutable to something immutable, the resulting
type must be mutable, as some of the contents is mutable and could be
changed - if that can happen the result can't be immutable. To get
around this there's .idup I believe.
This is true in a more general sense, but not for
string-concatenation. The ~ operator always creates a copy of the
array elements. So even with
y = x ~ "";
y will point to different data than x, so it would be okay to be mutable.
Your statement is however true for arrays of
Object/Pointer/any-reference-type instead of simple chars.
Krox