Binding rvalues to ref parameters redux
Nicholas Wilson
iamthewilsonator at hotmail.com
Thu Mar 28 16:07:17 UTC 2019
On Thursday, 28 March 2019 at 14:36:59 UTC, bitwise wrote:
> On Wednesday, 27 March 2019 at 01:38:40 UTC, Andrei
> Alexandrescu wrote:
>> 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]
Thats because it was never an issue with the dip, the conflation
was entirely deliberate, It is the review if the dip that was
wrong. This issue is resolved by the fact that temporaries
created are not usable after the expression they appear in, and
things that look like lvalues (e.g. @property functions) are
disallowed as candidates for rvalue -> ref conversion.
> 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?
Code breakage.
More information about the Digitalmars-d
mailing list