DIP25 draft available for destruction

Rob T alanb at ucora.com
Thu Feb 7 10:01:13 PST 2013


On Thursday, 7 February 2013 at 09:21:38 UTC, deadalnix wrote:
> On Thursday, 7 February 2013 at 08:48:30 UTC, Rob T wrote:
>> On Thursday, 7 February 2013 at 05:54:29 UTC, deadalnix wrote:
>>> On Thursday, 7 February 2013 at 05:43:24 UTC, Rob T wrote:
>>>> In other words @safe should explicitly mean "I hereby verify 
>>>> that the code is safe" not "I will silently re-write your 
>>>> code in unknown ways to make it safe".
>>>>
>>>
>>> @safe never meant that and Andrei never suggested that.
>>
>> I must have misunderstood something. What did he mean by this?
>>
>> ------------
>>> 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
>> ------------
>>
>> What is being allocated on the heap?
>>
>
> The frame pointer is, and it isn't dependent of @system or 
> @safe .


S* foo()@safe{
     S s;
     return &s;
}


In the above example, will s be silently allocated on the heap?

--rt


More information about the Digitalmars-d mailing list