Binding rvalues to ref parameters redux

bitwise bitwise.pvt at gmail.com
Thu Mar 28 14:36:59 UTC 2019


On Wednesday, 27 March 2019 at 01:38:40 UTC, Andrei Alexandrescu 
wrote:
> Work has been underway on redoing DIP 1016. I haven't made a 
> pull request yet as it's a bit early. Looking for high-level 
> observations:
>
> https://gist.github.com/andralex/e5405a5d773f07f73196c05f8339435a
>
> Thanks in advance for any feedback.

 From the response to DIP 1016:

> Here, the DIP Author clearly expresses two reasons why a 
> programmer may choose to declare a function to accept `ref` 
> arguments. The Language Maintainers see this as the core of the 
> proposal and would expect the distinction between the two cases 
> to be maintained throughout. [However, this proposal does not 
> maintain the distinction and instead conflates the two][1] 
> cases. The Language Maintainers insist that any proposal 
> allowing `ref` parameters to accept rvalue references must 
> clearly define how functions which make use of `ref` for side 
> effects will not accept rvalues.

I don't see anything in the new DIP that addresses the above 
issue. [1]

It seems like a waste to have a keyword that's just an alias for 
two others (in = const scope), so why not put 'in' to better use, 
like to qualify a ref parameter as accepting rvalues, or to 
outright replace 'ref' for rvalue-ref accepting parameters?

   Bit


More information about the Digitalmars-d mailing list