Cannot call mutable method on final struct

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Sep 10 07:13:46 PDT 2007


"Christopher Wright" <dhasenan at gmail.com> wrote in message 
news:fc3bdu$8tn$1 at digitalmars.com...
> 'string ~= whatever' is valid because the string is not final. The 
> compiler rewrites it as 'string = string ~ whatever'.

Iiii wouldn't be so sure about that.  I don't know if the compiler rewrites 
"a ~= b" as "a = a ~ b" when dealing with const stuff, but as far as D1 
goes, ~= and ~ are two different operations.  ~ always creates a copy of the 
original data, while ~= attempts to resize the destination in place and 
append the new data in the newly-resized space. 




More information about the Digitalmars-d-learn mailing list