http://wiki.dlang.org/DIP25 has been preliminarily approved for 2.067
Joseph Cassman via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jan 16 16:29:01 PST 2015
On Saturday, 17 January 2015 at 00:14:47 UTC, Andrei Alexandrescu
wrote:
> 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
Overall I like this improvement. I think the change to `return`
is good, keeps things clear; at least I had difficulty keeping
the various usages clear (didn't have time to comment in the
thread). Thanks for that. Also, I realized I was unclear about it
applying to safe and not unsafe code, and why. Nice
clarification. Thanks.
Joseph
More information about the Digitalmars-d
mailing list