DIP25 draft available for destruction
Timon Gehr
timon.gehr at gmx.ch
Wed Feb 6 14:22:56 PST 2013
On 02/06/2013 11:14 PM, Andrei Alexandrescu wrote:
> On 2/6/13 5:05 PM, Timon Gehr wrote:
>> On 02/06/2013 08:12 PM, Andrei Alexandrescu wrote:
>>> It would be more consistent with C++, but less so with the notion of
>>> safety. I find it very consistent that all uses of &expression are safe,
>>> and this is the kind of consistency Walter and I believe is worth aiming
>>> for.
>>>
>>
>> So you are saying this should compile?:
>>
>> struct S{
>> int x;
>> int foo()@safe{ return x; }
>> }
>>
>> int delegate()@safe foo()@safe{
>> S s;
>> return &s.foo;
>> }
>
> Yah, it should, and it also should detect the escape and allocate foo's
> frame on the heap.
>
> Andrei
>
I see. Generally?
Eg. this detects the escape and allocates as well?:
S* foo()@safe{
S s;
return &s;
}
More information about the Digitalmars-d
mailing list