DIP 1016--ref T accepts r-values--Community Review Round 1

meppl mephisto at nordhoff-online.de
Fri Jul 20 15:50:29 UTC 2018


On Friday, 20 July 2018 at 13:21:11 UTC, Jonathan M Davis wrote:
> On Friday, July 20, 2018 05:16:53 Mike Parker via Digitalmars-d 
> wrote:
>> ...
>
> ...
> Allowing ref to accept rvalues goes completely against the idea 
> that ref is for passing an object so that it can be mutated and 
> have its result affect the caller. With this DIP, we'd likely 
> start seeing folks using ref all over the place even when it 
> has nothing to do with having the function mutating its 
> arguments, and that's not only error-prone, but it obfuscates 
> what ref was originally intended for.
> ...
>

So, if `immutable` would be the default in D, you would be okay 
with "DIP 1016"?  Because then people would have to write `ref 
mutable` for mutation


More information about the Digitalmars-d mailing list