Why are globals set to tls by default? and why is fast code ugly by default?

ryuukk_ ryuukk.dev at gmail.com
Fri Mar 31 15:54:42 UTC 2023


On Friday, 31 March 2023 at 10:32:53 UTC, Nick Treleaven wrote:
> On Sunday, 26 March 2023 at 20:36:37 UTC, ryuukk_ wrote:
>> Golang doesn't even have thread local storage, yet they do 
>> very well
>
> Go doesn't have a solution to preventing data races at compile 
> time, they just say don't share memory. But what if you 
> accidentally share memory? That is *very* easy to do in Go. You 
> and your users are out of luck. All you can do is run the race 
> detector and pray that you happen to test all the code paths 
> with it that might have data races:
>
>> The race detector only finds races that happen at runtime, so 
>> it can't find races in code paths that are not executed
>
> https://go.dev/doc/articles/race_detector

If you want TLS in GO, you specify that you need a TLS variable, 
just like every sane languages

Go went the smart route on top of having goroutines, making it 
superior to what ever D offer


More information about the Digitalmars-d-learn mailing list