[Dlang-study] [lifetime] Few root decisions to take on RC classes

Timon Gehr timon.gehr at gmx.ch
Mon Nov 2 12:24:14 PST 2015


On 11/02/2015 01:20 AM, Andrei Alexandrescu wrote:
> On 11/1/15 4:14 PM, Martin Nowak wrote:
>> - If the compiler knows a reference has a limited lifetime
>>    it could check for @noescape making most of RC implementable
>>    in a library.
>>
>>    struct RC
>>    {
>>      Object get() return; // lifetime of Object is bound to RC, compiler
>> could check any function called on Object for @noescape
>>    }
>
> Yah, I think it's worth exploring a variant in which we annotate
> @noescape methods and then only allow those methods to be called from
> RC!T.get.

@noescape in the presented form is not modular, which will be painful 
outside toy examples.


More information about the Dlang-study mailing list