On 10/19/2012 09:53 AM, Jacob Carlborg wrote:
On 2012-10-19 04:48, Timon Gehr wrote:

Then how to specify that the value of x cannot be escaped?
I'm in favour of doing it the other way round and disallow escaping of
ref parameters without an unsafe cast.

"scope" is supposed to be used to prevent this.


Sure, but how?

void goo(scope int* x){
    global0 = x; // should clearly be disallowed
}

void foo(scope ref int*** x){
    global1 = &x; // ?
    global2 = x;  // ?
    global3 = *x; // ?
    globall4 = **x; // ?
}

Maybe we need this:

void foo(scope ref int*** x);   // ?
void foo(ref int(***)scope  x); // no escaping of x, *x, **x
void foo(ref int*(**)scope x);  // may escape **x
void foo(ref int**(*)scope x);  // may escape *x, **x

What about &x?

Reply via email to