[Dlang-study] [lifetime] Initial thoughts on lifetime management

Andrei Alexandrescu andrei at erdani.com
Tue Oct 27 17:46:34 PDT 2015


I should add here another pattern that turned problematic for our older 
attempts in DIP74:

C c = new C();
foo(c);

int foo(scope C d) {
     c = new C();    // c's old instance gets deleted
     return d.i;        // oops! d is invalid
}


Andrei


More information about the Dlang-study mailing list