[Dlang-internal] DIP1000 discussion and testing

Walter Bright via Dlang-internal dlang-internal at puremagic.com
Sat Oct 22 00:54:24 PDT 2016


On 10/21/2016 4:54 AM, Martin Nowak wrote:
> On Friday, 21 October 2016 at 11:39:27 UTC, Martin Nowak wrote:
>> The problem that remains could be stated as lifetime tunneling.
>>
>> Given `v2 = func(v1)` lifetime(v2) = lifetime(v1) according to 5.
>> Changing lifetime(v1) by `v1 = e` can change lifetime(v2) to < reachability(v2).
>
> This doesn't manifest easily because there are no named reference variables and
> converting references to pointers isn't allowed in @safe code.
> But the void dangling(ref A a, scope ref B b) is one way to run into this.
> Can we at least enforce that any value/reference returned by `func(v1)` cannot
> be bound to a v2 in the calling scope while still referencing v1?

I don't really understand the question. Can you recast it in terms of a short 
example?


More information about the Dlang-internal mailing list