[Dlang-internal] DIP1000 discussion and testing

Mathias Lang via Dlang-internal dlang-internal at puremagic.com
Fri Dec 16 09:08:13 PST 2016


On Friday, 16 December 2016 at 16:43:30 UTC, Mathias Lang wrote:
>
> Lack of transitivity is one thing, inability to express 
> something more complex than a top level scope is another.

Another, hopefully even better test case for what I'm trying to 
express:

```
void main () @safe
{
     int* a = escape();
}

int* escape () @safe
{
     int i;
     int*[3] a = [ &i, null, null ];
     return bar(&a[0]);
}

int* bar (scope int** x) @safe
{
     return foo(*x);
}

int* foo (int* x) @safe { return x; }
```

As long as we have:
- No way to express different `scope` levels (the "backward" 
transitivity)
- A way to take the address of `scope` pointers

We will still have that hole.

> Compiles with `./src/dmd -transition=safe -dip25 test.d` on 
> commit fbbfce8f6e0afb716ec96ba3dc2e82b3536cbaac (with the 
> latest 2 P.R. merged).



More information about the Dlang-internal mailing list