http://wiki.dlang.org/DIP25 has been preliminarily approved for 2.067

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 16 15:55:20 PST 2015


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


More information about the Digitalmars-d mailing list