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

Manu turkeyman at gmail.com
Mon Oct 14 17:40:26 UTC 2019

On Sun, Oct 13, 2019 at 4:30 PM Ola Fosheim Grøstad via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> 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
> interpretation.
> A matter of intersubjectivity, e.g people sharing the same
> interpretation.
> > 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.

They could, but they don't..
You're talking about a lot of hypothetical, I'm talking about how D
is, and how it's always been.

> > It goes very badly every time I've tried this.
> I'll have to take your word for it... Something serious?

It just doesn't scale, and relies extremely heavily on template constraints.
You lose; function pointers, virtual functions, binary libs, DLL's,
etc... you also lose auto-complete style features in the editor.
Templates should be the solution to generic code problems, not to
problems like this.

> >> 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.

What's the point of that tangent though?
We're not seriously going to consider changing the way const is
defined in D, and make a proposal for user-defines type constructors
in a conversation about making shared work properly.

> > 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.

I agree it should have been like this from the start, but it exists,
it's the tool we have, and we need to make it work properly.

More information about the Digitalmars-d mailing list