Eliminate redundancy of dup/idup

Adam D. Ruppe destructionator at gmail.com
Sun Sep 9 09:33:26 PDT 2012


On Sunday, 9 September 2012 at 16:25:12 UTC, Timon Gehr wrote:
>>>         c = "another"; // so this compiles
>
> This does not compile anymore now.


One option I've heard that might be OK is to make auto strip off 
the top level immutable:

immutable(char[]) a;
auto b = a; // b is immutable(char)[]
b = "test"; // allowed


This kind of thing is already done on function calls.


If you want to keep the full immutability including the top one, 
use immutable instead of auto.


More information about the Digitalmars-d mailing list