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

z z at z.com
Mon Mar 27 08:08:20 UTC 2023


On Sunday, 26 March 2023 at 18:07:03 UTC, ryuukk_ wrote:

> ``shared`` is even more ugly since everything must be shared 
> afterwards

The limitations of `shared` can be bypassed with a "function" 
that removes type qualifiers. `return *cast(Unqual!T*) 
&foo`(example, doesn't work as is for arrays.)

This way `shared` symbols can be used with functions that 
*cannot* be made compatible with both shared and non-shared.(by 
cannot the exact reasons seem obscure, it may be that a called 
function *would* support `shared` parameters but calls a function 
with the parameter that does not, ime this is painfully apparent 
with `struct`s' member functions)

Naturally there's the risk of concurrency issues because this 
isn't the language documentation-recommended way of doing things, 
but D's library has these problems covered.


More information about the Digitalmars-d-learn mailing list