Binding rvalues to ref parameters redux

bitwise bitwise.pvt at gmail.com
Sat Apr 6 17:01:31 UTC 2019


On Friday, 5 April 2019 at 12:19:34 UTC, Atila Neves wrote:
> On Thursday, 4 April 2019 at 19:29:54 UTC, bitwise wrote:
>> On Thursday, 4 April 2019 at 13:43:32 UTC, Atila Neves wrote:
>>> +1. I *want* `in` to be `scope const`. Any code that breaks 
>>> as a result of DIP1000 that uses `in` deserves to break 
>>> anyway.
>>
>> Do you have any preference on whether or not 'in' is required 
>> for an rvalue to bind to ref?
>
> No. Especially not before seeing the new DIP for that.

Could you please explain?

At this point, I was suggesting that 'in' be used without 
changes, so no DIP should be required for that.

As far as the new rvalue DIP, I would only add `in` as an 
additional requirement for rvalues binding to `ref`. The only 
issue I can see with this is `in` indirectly adding `scope` to a 
`ref` parameter, which after DIP25, doesn't really make sense.

DMD v2.085.0 does allow adding `scope` to a `ref` param with 
-dip25, which seems odd. Do the duplicate storage classes 
collapse by design (like C++'s reference collapsing), or will 
'scope ref' eventually fail to compile or change meaning?



More information about the Digitalmars-d mailing list