Shared - Another Thread

Stanislav Blinov stanislav.blinov at gmail.com
Wed Oct 17 21:40:35 UTC 2018


On Wednesday, 17 October 2018 at 21:29:07 UTC, Stefan Koch wrote:

> in any case it would certainly mess up
>  the state of everyone involved; which is exactly what happens 
> win multi-threaded situations.

^ that is very true. And that is why:

- one must not keep shared and local data close together (e.g. 
within same cache line)
- one must not implicitly convert local data to shared data

Now, I perfectly understand what Manu wants: for `shared` to stop 
being a stupid keyword that nobody uses, and start bringing in 
value to the language. At the moment, the compiler happily allows 
you to write and read `shared` unhindered, which isn't useful at 
all. It also allows you to have weird things like shared 
destructors and postblits (which got extended to whole shared 
copy ctors in a DIP!). Latter is especially painful when 
attempting to define the whole type `shared`.


More information about the Digitalmars-d mailing list