On Sat, 18 May 2013 16:59:53 +0200, Sean Kelly <s...@invisibleduck.org> wrote:

This is expected because the global is __gshared and there's therefore no type protection from doing this. If you want safe sharing, make the global shared.
[snip]
__gshared int[] gArr = [1,2,3];
int[] arr = gArr;

Uhm, you are aware this is the Bugzilla newsgroup, right? Please reply in
Bugzilla.

Also, that's exactly what we're saying. This code has problems:

import core.thread;

int[] arr = [1,2,3];

void main() {
    new Thread({arr[0] = 3;});
    assert(arr[0] == 1);
}

And they are caused by the data inside arr being shared. This is unsafe,
unexpected (due to safety of other globals) and, we feel, goes against
the D ethos.

--
Simen

Reply via email to