Eliminate redundancy of dup/idup

Timon Gehr timon.gehr at gmx.ch
Sun Sep 9 09:39:21 PDT 2012


On 09/09/2012 06:33 PM, Adam D. Ruppe wrote:
> 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.

I am in favour of this change, but why would it help eliminate the 
usefulness of .idup?


More information about the Digitalmars-d mailing list