Rvalue references - The resolution

deadalnix deadalnix at gmail.com
Sat May 4 17:02:46 PDT 2013


On Saturday, 4 May 2013 at 23:30:01 UTC, Walter Bright wrote:
> On 5/4/2013 3:50 PM, deadalnix wrote:
>> Require isn't the right word, or you hav to explain yourself 
>> much more.
>
> You need an explicit annotation if a ref parameter is returned 
> by ref by that function. This is what Rust's annotations do.
>
> Consider:
>
>     ref T foob(ref U u) { return u.t; }
>
>     ref U bar() { U u; return foob(u); }
>
> The compiler cannot know that the ref return of foob is 
> referring to local u (as opposed to, say, a ref to a global) 
> unless it is annotated to say so. Rust is no different.

This code sample won't require any annotation in Rust. And it 
illustrate wonderfully what I'm saying : most people in the 
discussion (and it has been shown now that this includes you) 
were unaware of how does Rust solve the problem.

I don't think excluding a solution that isn't understood is the 
smartest thing to do.


More information about the Digitalmars-d mailing list