DIP 36: Rvalue References

Namespace rswhite4 at googlemail.com
Mon Apr 22 08:05:29 PDT 2013


> I have but the DIP isn't consistent
I must have overlooked this all the time. I will clean up this 
inconsistency.
The statement that only adressable elements are taken by scope 
ref is not true anymore. Both, scope ref and in ref can take any 
values. If it is an rvalue, a temporary is created and this is 
passed to the function.
Thanks for the hint.

> In which case why not allow passing R-value references as 
> normal "ref" parameters? Why the need for "scope" when the only 
> new restriction it introduces can (and should) be avoided.

> DIP25 says that the return value of a ref function must not be 
> assumed to have a lifetime longer than the shortest lifetime of 
> any of its ref parameters. This formulation works just as well 
> for an R-value reference as it does for a reference to a local 
> variable, just that the first is slightly shorter.

You should search for "rvalue references". 'ref' that takes both, 
lvalues and revalues was suggested and AFAIK rejected.
Otherwise you could open a new DIP or first a thread and ask for 
this. I'm curious of the answers.
This issue is very old (Exactly one year ago it was officially 
discussed for the first time). But the core problem exist since 
2.038. There was 'auto ref' introduced. This was the first 
attempt to solve this problem. Long long time ago and it annoys 
us still today.


More information about the Digitalmars-d mailing list