Weird DIP1000 issue

Paul Backus snarwin at gmail.com
Wed Feb 8 23:03:17 UTC 2023


On Wednesday, 8 February 2023 at 22:25:32 UTC, tsbockman wrote:
> Since `&_errors[0]` is a pointer to a stack variable, it must 
> be `scope`. Pointers get transitive `scope`, so the `char*` is 
> infected, too.
[...]
> Again, the `_errors[]` slice contains a pointer to a stack 
> variable, so it must be `scope`. Slices get transitive `scope`, 
> like pointers.
[...]
> I think most of the confusion surrounding `scope` and related 
> attributes stems from the fact that `scope` is transitive, when 
> it really shouldn't be.

This really is a good illustration of the confusion surrounding 
`scope`, because `scope` is not transitive and never has been:

```d
char* global;

void main() @safe
{
     char* local;
     scope char** p = &local;
     global = *p; // ok
}
```


More information about the Digitalmars-d mailing list