On Friday, 31 March 2023 at 10:26:32 UTC, Nick Treleaven wrote:
On Sunday, 26 March 2023 at 20:39:21 UTC, ryuukk_ wrote:
if my code doesn't do threads, why should i put my variable
into TLS?
I don't think writing __gshared is much of a burden. You can
use -vtls to print out all variables that are TLS, and add that
to an automated test to check you don't have any accidentally.
I have thought before that a --no-threads compiler switch that
does not link the key thread functions but makes __gshared the
default might be a good enhancement for your use case. Then if
you accidentally call some code that uses std.parallelism
internally you would get a link error.
If i want fast code, why should i make use of ugly syntax?
1. If you want fast code, why aren't you using threads?
2. By default D supports threads and accidental data races are
far worse than ugly syntax.
It is a burden to type things you don't need, and to type things
that are ugly on purpose
I recently discovered -vtls and indeed is very nice to have,
managed to clear out all my TLS usage, but made my code even more
ugly ``__gshared`` everywhere..
If you want fast code, why aren't you using threads?
threads is not synonymous of fast code
and if i were to use thread, i'd not rely on globals to begin with
By default D supports threads and accidental data races are far
worse than ugly syntax.
Debatable, but that's a good point, but that's not the point i
bring, the point i bring is ``__gshared`` is ugly, so we want an
ugly language?