Implicit conversion to mutable if no indirections?

Mathias LANG pro.mathias.lang at gmail.com
Sun Sep 4 12:33:37 UTC 2022


On Sunday, 4 September 2022 at 11:03:53 UTC, Nick Treleaven wrote:
> On Friday, 2 September 2022 at 18:58:43 UTC, Ali Çehreli wrote:
>> But I am aware that we can't deduce T to be 'int' because we 
>> would be losing that qualifier and further template deductions 
>> would be wrong. :/
>
> Another feature that would be interesting is if an `auto` 
> declaration stripped const/immutable where possible. After all, 
> if the user didn't want that they could've used `const` or 
> `immutable`.
>
> ```d
> const i = 4; // const int
> auto v = i;  // int
> const a = [0]; // const(int[])
> auto s = a;    // const(int)[]
> ```

This has been discussed in another thread and Walter approved it. 
Just need to implement it.


More information about the Digitalmars-d mailing list