On 1/16/15 3:55 PM, Steven Schveighoffer wrote:
On 1/16/15 6:25 PM, Walter Bright wrote:
On 1/16/2015 3:10 PM, zeljkog wrote:
Why is it restricted to @safe?
Being a systems programming language, an escape from it may be necessary.
So:
ref int foo(ref int x) { return x; }
is OK as long as it's not marked @safe? Is this made clear in the DIP? I
didn't see that. In fact @safe is never mentioned except in the code
examples. Even in the inline text examples, it's not mentioned.
In at least one place, it's implied that the above would not compile
under the DIP: "With the proposed semantics, a function is disallowed to
return a ref parameter of a part thereof UNLESS the parameter is also
annotated with return."
-Steve
The DIP applies to @safe code only for now. Steve, could you please add
a clarifying section. Thanks! -- Andrei