Binding rvalues to ref parameters redux

Nicholas Wilson iamthewilsonator at hotmail.com
Thu Apr 4 00:16:11 UTC 2019


On Wednesday, 3 April 2019 at 16:57:10 UTC, bitwise wrote:
> On Tuesday, 2 April 2019 at 23:40:42 UTC, Nicholas Wilson wrote:
>> On Monday, 1 April 2019 at 16:43:15 UTC, bitwise wrote:
>>> On Thursday, 28 March 2019 at 16:07:17 UTC, Nicholas Wilson 
>>> wrote:
>>> Any code using 'in' right now deserves to break. (but 
>>> actually, that may not be necessary)
>>
>> That change is still within our 2 year deprecation period and 
>> I think it was not a good move.
>
> I don't understand - are you saying it was already deprecated?

No, I'm saying I don't think it was a good move to change it for 
const scope to const.
I certainly don't remember any community discussion about it at  
the time.

> Even if deprecating it was just a discussion - are there 
> already plans for 'in'?

In theory it is becoming synonymous with 'const'.

>>> So finally, I would suggest that rvalues only bind to 'in 
>>> ref'.
>>
>> This comes down to an opt in vs opt out, 'in ref' (leaving 
>> aside the issues with const) mean that bindings and code must 
>> be updated to allow use, whereas rvalues not binding to 'out 
>> ref' allows immediate use. I'm for opt out.
>
> Was 'out ref' a typo?

No, sorry I forgot to define it. Out ref would mean 'one point of 
this function is to mutate that argument as a side effect so it 
can't be an rvalue.'



More information about the Digitalmars-d mailing list