On 05/24/2013 04:39 PM, Simen Kjaeraas wrote: > First, *is* it read-only? If so, store it as immutable and enjoy free > sharing. If not, how and why not?
I can confess that it's as simple as feeling extremely uncomfortable dealing with immutable where it relates to any kind of complex data structure. I mean, for that double array structure I'd have to do something like, Tuple!(size_t, size_t)[][] dataCopy; foreach(x; data) { Tuple!(size_t, size_t)[] xCopy; foreach(y; x) { immutable(Tuple!(size_t, size_t)) yCopy = y.idup; xCopy ~= cast(Tuple!(size_t, size_t)) yCopy; } immutable xImm = assumeUnique(xCopy); dataCopy ~= cast(Tuple!(size_t, size_t)[]) xImm; } immutable dataImm = assumeUnique(dataCopy); ... no? Which feels like a lot of hassle compared to just being able to pass each thread the information to independently load the required data. I'd be delighted to discover I'm wrong about the hassle of converting the data to immutable -- I don't think I understand how to use it at all well, bad experiences in the past have meant that I've tended to avoid it.