Denis Koroskin wrote:
I agree. It also grants safe way to pass temporaries:int bar(); int* gi; void foo(ref int i) { gi = &i; } foo(bar()); // unsafe
Well rvalues still shouldn't bind to temporaries because I want to allow a function to return by ref a ref parameter:
ref int foo(ref int i) { if (i == 0) ++i; return i; } Binding an rvalue to a ref would essentially pass a zombie out of foo. Andrei