On Sunday, 29 May 2016 at 05:43:31 UTC, Mike Parker wrote:
On Sunday, 29 May 2016 at 05:35:33 UTC, Mike Parker wrote:
Well then, this completely breaks my understanding of variable
scope.
OK, I see now at [1] the following:
" Immutable data doesn't have synchronization problems, so the
compiler doesn't place it in TLS."
I've read that page more than once, but I had forgotten this
bit. Still, I don't see anything there about const. I would not
expect const variables to behave the same way, given the weaker
guarantee about modification. But if they are intended to
behave that way, then, IMO, it should not be possible to
reinitialize them in a static constructor.
https://dlang.org/migrate-to-shared.html
It's reasonable to treat const variables like immutable when the
const variable has no indirections. However, it shouldn't allow
rewriting the variable in each thread ctor.
-Steve