std.functional.memoize : thread local or __gshared memoization?

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Sat May 27 03:29:05 PDT 2017


On Saturday, 27 May 2017 at 10:02:35 UTC, Jonathan M Davis wrote:
> As such, the fact that D programmers frequently decide to use 
> __gshared in order to avoid dealing with the restrictions with 
> shared is actually extremely bad. You can get away with it in 
> some cases, but it's error-prone and is only going to get worse 
> as the compiler improves.

Hm, I would think that using __gshared would not be affected by 
compiler improvements, since it would turn off optimizations that 
assume that the variable doesn't change between reads?



More information about the Digitalmars-d mailing list