On Sunday, 21 October 2018 at 09:58:18 UTC, Walter Bright wrote:
On 10/20/2018 11:08 AM, Nicholas Wilson wrote:
You can if no-one else writes to it, which is the whole point of Manu's proposal. Perhaps it should be const shared instead of shared but still.

There is no purpose whatsoever to data that can be neither read nor written.

Indeed but there is a subtle difference between that and Manu's proposal: access through the shared variable may not have non-atomic reads, not no reads.

Shared data is only useful if, at some point, it is read/written,

Yes

presumably by casting it to unshared in @trusted code.

That is one way to do it, others include atomics and other @trusted primitives

As soon as that is done, you've got a data race with the other existing unshared aliases.

You're in @trusted code, that is the whole point. The onus is on the programmer to make that correct, same with regular @safe/@trusted@system code.

Reply via email to