On 08/16/2016 07:26 PM, Patrick Schluter wrote:
> What happens in that case ?
> 
> void test() {
> scope rnd  = new Rnd; // reference semantic and stack allocated
> Rnd rnd2;
>  rnd2 = rnd;
>          some_sneaky_function_that_saves_global_state(rnd);
> }
> 
> or is that not even possible ? (sorry I'm still a noob in D).

If `Rnd` is supposed to be a class, it won't compile because it would
mean escaping scope reference to non-scope variable (with DIP1000). If
it is a struct, it won't compile because you are trying to assign `Rnd*`
(pointer) to `Rnd` (value) :)

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to