[Dlang-internal] DIP1000 discussion and testing

Walter Bright via Dlang-internal dlang-internal at puremagic.com
Sat Oct 29 19:17:36 PDT 2016


On 10/29/2016 4:30 AM, Dicebot wrote:
> Most obvious problem is an owning container type:
>
> struct Tree (T)
> {
>     private Node!T* head;
>
>     ~this ( ) { delete this.head; }
>
>     TreeRange range ( ); // returned range must not outlive
>                          // this struct instance
> }
>
> There really needs to be a way to bind returned value lifetime to `this`
> explicitly. No special cases, no magic, just one of straightforward use
> cases.

This is covered by my proposed modification:

struct Tree
{
     TreeRange range ( ) scope;
}




More information about the Dlang-internal mailing list