DIP25 draft available for destruction

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Feb 6 14:14:42 PST 2013


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



More information about the Digitalmars-d mailing list