On Tuesday, 5 February 2013 at 20:24:16 UTC, Andrei Alexandrescu wrote:
I hope it at least considers my proposal with regard to 'out' return values. 'out' implies ref and guarantees that the result is as good as
global:

out int foo(ref int a) { return a; } // Error, 'out' return may not
return ref parameter
out int goo(ref int a) { return new int; } // Fine

My impression was that this would solve 98% of problems, the other 2%
requiring scope parameters, which also imply ref:

ref int haa(ref int a, scope int b) { return b; } // Error, may not
return scope parameter
ref int gaa(ref int a, scope int b) { return a; } // Fine

I'm sorry, I didn't know of that proposal. Generally we're aiming for economy of means i.e. we want to clarify semantics of existing syntax instead of adding new syntax and semantics.

Andrei

It's not a new syntax, just new semantics. Also, the reason for adding these semantics to the function signature was so that the compiler would never have to leave the function in order to compile it. It's a natural complement to ref returns' scope being the most local of the ref parameters, which you suggested in your proposal. It keeps that too.

Reply via email to