DIP69 - Implement scope for escape proof references

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 4 03:52:15 PST 2014


On Thursday, 4 December 2014 at 11:21:27 UTC, Marc Schütz wrote:
>> Errors for scope violations are only reported in @safe code.
>
> Why? If I've explicitly designated a reference as scope, why 
> should it be ignored in un- at safe code?

Agreed, it should also work for any other code with some function 
to cast away scope.

ref T unscope(scope ref T t) @system
{
     auto p = &t;
     return *p;
}


More information about the Digitalmars-d mailing list