On Tuesday, 2 August 2016 at 21:48:58 UTC, Mark Twain wrote:
global ImmutableArray!int Data;
MutableArray!int DataCopy = Data.Copy; // Creates a mutable
copy of Data.
... Do work with DataCopy ...
Data.Replace(DataCopy); // Makes a copy of DataCopy.
I see the problem that you cannot compose this. Expand the
example to two global arrays:
global ImmutableArray!int Data1;
global ImmutableArray!int Data2;
MutableArray!int DataCopy1 = Data1.Copy;
MutableArray!int DataCopy2 = Data2.Copy;
... Do work with DataCopy1 and DataCopy2 ...
Data1.Replace(DataCopy1);
// in between state is inconsistent => unsafe
Data2.Replace(DataCopy2);