[dmd-concurrency] shared arrays

Andrei Alexandrescu andrei at erdani.com
Thu Jan 14 11:36:47 PST 2010


Steve Schveighoffer wrote:
> What about shared(T)[] where T.sizeof >= 2*(size_t.sizeof) ?  If copying an array reference is unusable, then why is copying large array elements usable?  This whole point has confused me...
> 
> Should the runtime throw an exception when asked to copy such arrays?

It's a compile-time error. Assignment of shared values is defined only 
for types up to word-size that don't define constructors. If this 
doesn't compile:

foreach (i; 0 .. a.length) b[i] = a[i];

then this shouldn't compile either:

b[] = a[];


Andrei



More information about the dmd-concurrency mailing list