DIP 1024--Shared Atomics--Community Review Round 1

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun Oct 13 23:26:05 UTC 2019

On Sunday, 13 October 2019 at 21:44:45 UTC, Manu wrote:
> On Sun, Oct 13, 2019 at 2:10 PM Ola Fosheim Grøstad via 
> Digitalmars-d <digitalmars-d at puremagic.com> wrote:
> How so?
> `shared` is exactly like const, but with an additional 
> restriction
> that you can't read either.

Shared provides only identity of the top level.
Const provides recursively methods for reading.

> "if you have syntactical means to get around it" <- this is 
> `shared`; if we lose shared, we lose thread-local.

Nah, C++ memory was local... Threads came through a 
library/syscall. Didn't loose or win the concept of local 
memory... It is semiotic if not strictly enforced, a matter of 
A matter of intersubjectivity, e.g people sharing the same 

> Assuming there were no shared, and "data is thread-local" is
> specified, then you'd be doing UB anytime you spawn a second 
> thread...

No, they could have disjunct stores. Like JavaScript where you 
transfer unique ownership.

Conceptually close to using a mutex... Except in the mutex case 
there is no formal representation, the connection between mutex 
and object is in the head of the programmers.

> not correct. thread-local by default exists because `shared` 
> exists.

Nah, I'd rather say that you can transfer ownership. Shared just 
means that it is up for grabs, it is in transition. Just like in 
JavaScript. At some point the mediating system is in control.

No conflict.

> It goes very badly every time I've tried this.

I'll have to take your word for it... Something serious?

>> 2. you can extend the meta programming capabilities and have a 
>> more advanced  solution that is more in line with the current 
>> syntax
> That's a huge development, and much uncertainty.
> And it's not like we're introducing shared here... he's been in 
> D
> forever, we're just making it mean something.

Yes, there might be a cultural barrier to changing the 
syntax/expected features.

> I don't understand... I think they're almost identical 
> hard-ness.

You can a simple shared wrapper in 10 lines, so I don't 
understand the "identical" part...

> We're not designing foundational mechanisms, Walter designed 
> shared
> decades ago and it's firmly embedded in the language.

Designed? If it was, there would be no DIP.

More information about the Digitalmars-d mailing list