The following solution

http://static.rust-lang.org/doc/master/intro.html#owning-concurrency

is partially a good start...

but I believe it would be better to let the (D) compiler optimization stage figure out _automatically_ if it needs to make a copy of the variable `numbers` or not depending on whether `numbers` is used or not further down the body of `main`.

Are there currently any semantic passes in DMD that checks where reference data are read/written that could be utilized here?

Also Walter has talked about loads of data flow optimizations pending in DMD that for example automatically make new expressions immutable (and in turn shareable without locks) when possible.

Reply via email to