rvalues -> ref (yup... again!)

Kagamin spam at here.lot
Fri Mar 30 09:47:34 UTC 2018

On Wednesday, 28 March 2018 at 16:15:53 UTC, Manu wrote:
> I discussed that in that document. I'm happy to remove const, 
> but it requires a value judgement on the meaning of non-const 
> in this case. It becomes controversial without const, but I'm 
> personally happy to remove it if you can make The argument in 
> favour. Can you give me some ideas where it would be useful?

>doesn't make sense because the output would be immediately 
>discarded; such a function call given an rvalue as argument 
>likely represents an accidental mistake on the users part, and 
>we can catch that invalid code.

Most obvious:

void Close(ref HANDLE h)

If you want to take input argument, then of course mark it as 
input, but if not then not. Why the callee would need to care if 
the argument is rvalue or not? The only criticism against rvalue 
references I saw was when the reference outlives the temporary.

More information about the Digitalmars-d mailing list