<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 15, 2016 at 2:49 PM, Dicebot via Digitalmars-d-announce <span dir="ltr"><<a href="mailto:digitalmars-d-announce@puremagic.com" target="_blank">digitalmars-d-announce@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="">On 08/15/2016 03:41 PM, Rory McGuire via Digitalmars-d-announce wrote:<br>
> scope rnd  = new Rnd; // reference semantic and stack allocated<br>
</span><span class="">> auto rnd2 = rnd;<br>
><br>
> rnd.i = 2;<br>
> assert(rnd2.i == 2);<br>
> return rnd2;<br>
<br>
</span>Point is that that would become illegal if DIP1000 is implemented thus<br>
giving scope class concept more justification. It would still have @safe<br>
holes though because proposed `scope` does not work through many<br>
indirection levels - but better than existing situation when nothing is<br>
checked.<br>
<br>
</blockquote></div><div class="gmail_extra"><br></div>okay nice, so that code would not compile but code such as:</div><div class="gmail_extra"><div style="font-size:9.6px">void test() {</div><span class="im" style="font-size:9.6px"><span style="white-space:pre-wrap">      </span>scope rnd  = new Rnd; // reference semantic and stack allocated<span style="white-space:pre-wrap">        </span></span><div style="font-size:9.6px"><span style="white-space:pre-wrap">      </span>auto rnd2 = rnd;</div><div style="font-size:9.6px">        some_sneaky_function_that_saves_global_state(rnd);</div><div style="font-size:9.6px">}</div></div><div class="gmail_extra">would still not be checked. And would crash inexplicably at the point the global was accessed?</div></div>