Pop quiz [memory usage]

Sean Kelly sean at invisibleduck.org
Sun Jun 7 19:24:09 PDT 2009


Steve Schveighoffer wrote:
> On Sat, 06 Jun 2009 21:59:39 -0700, Sean Kelly wrote:
> 
>> Steve Schveighoffer wrote:
>>> On Sat, 06 Jun 2009 12:03:03 -0700, Sean Kelly wrote:
>>
>> auto str1 = "hello".idup;
>> auto str2 = str3 = str1;
>> str2 ~= " world";
>> str3 ~= " garbage";
>>
>> Doesn't seem terribly safe to me.
> 
> Oh, I know.  It's a long-standing issue with immutability, but I think if 
> appending gets fixed as Andrei suggests, this should be fixed as well.  I 
> was just saying that your statement about immutable data never being 
> appended in-place was false.

Oops, I replied based on an educated guess--I should have tested it. 
Still, immutable arrays are hardly immutable if an append can alter 
their contents.



More information about the Digitalmars-d mailing list