On Mon, Aug 15, 2016 at 2:49 PM, Dicebot via Digitalmars-d-announce <
digitalmars-d-announce@puremagic.com> wrote:

> On 08/15/2016 03:41 PM, Rory McGuire via Digitalmars-d-announce wrote:
> > scope rnd  = new Rnd; // reference semantic and stack allocated
> > auto rnd2 = rnd;
> >
> > rnd.i = 2;
> > assert(rnd2.i == 2);
> > return rnd2;
>
> Point is that that would become illegal if DIP1000 is implemented thus
> giving scope class concept more justification. It would still have @safe
> holes though because proposed `scope` does not work through many
> indirection levels - but better than existing situation when nothing is
> checked.
>
>
okay nice, so that code would not compile but code such as:
void test() {
scope rnd  = new Rnd; // reference semantic and stack allocated
auto rnd2 = rnd;
        some_sneaky_function_that_saves_global_state(rnd);
}
would still not be checked. And would crash inexplicably at the point the
global was accessed?

Reply via email to