On Tuesday, 4 November 2014 at 14:36:19 UTC, Chris wrote:
I'm still curious, though, how D handles this internally, because data.data is still mutable while the other reference to the same address (tmp) is not. What if I change data.data while the other thread is being executed?
Changing *data.data would be undefined behaviour. Don't do it. Once data is typed as immutable, it must not change anymore. By casting you're side-stepping the type system, so that you have to make sure of such things yourself.