dip1000 rule 5

sclytrack fake at hotmail.com
Sun Nov 25 19:22:36 UTC 2018


There are 4 rules listed.

https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md




What is rule 5?


int* global_ptr;

void abc() {
     scope int* a;
     int* b;
     scope int* c = a;      // Error, rule 5
     scope int* d = b;      // Ok
     int* i = a;            // Ok, scope is inferred for i
     global_ptr = d;        // Error, lifetime(d) < 
lifetime(global_ptr)
     global_ptr = i;        // Error, lifetime(i) < 
lifetime(global_ptr)
     int* j;
     global_ptr = j;        // Ok, j is not scope
}


Also it says scope inferred for i
int * i = a;

So inferred, does that mean?

scope int *i = a;


It looks very similar to the error rule 5.

     scope int* c = a;      // Error, rule 5


When DIP1000 is in and copy constructors, then the language is 
more or less finished?

Wouldn't you call it D3 because of the name mangling of DIP1000 
once activated
by default?



More information about the Digitalmars-d-learn mailing list