DIP1000 scope inference

Steven Schveighoffer schveiguy at gmail.com
Tue Oct 25 13:55:03 UTC 2022


On 10/25/22 9:44 AM, Steven Schveighoffer wrote:
> But we did just go through an exercise where a struct not labeled scope 
> is inferred scope not because of its declaration, but because of later 
> things done with it.

It's very curious. I can't get any indication that the struct is 
inferred scope except by throwing an exception contained in it. If I 
declare the function @safe, it won't let me assign the scope variable to 
the struct member. If I mark it as @trusted, that succeeds, but then it 
won't let me throw the exception out of the struct because it says the 
struct is scope.

Again, with no way to tell whether scope is inferred, it's hard to judge.

-Steve


More information about the Digitalmars-d mailing list