Something needs to happen with shared, and soon.

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Nov 15 07:17:44 PST 2012


On 11/15/12 1:08 AM, Manu wrote:
> On 14 November 2012 19:54, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org <mailto:SeeWebsiteForEmail at erdani.org>>
> wrote:
>     Yah, the whole point here is that we need something IN THE LANGUAGE
>     DEFINITION about atomicLoad and atomicStore. NOT IN THE IMPLEMENTATION.
>
>     THIS IS VERY IMPORTANT.
>
>
> I won't outright disagree, but this seems VERY dangerous to me.
>
> You need to carefully study all popular architectures, and consider that
> if the language is made to depend on these primitives, and the
> architecture doesn't support it, or support that particular style of
> implementation (fairly likely), than D will become incompatible with a
> huge number of architectures on that day.

All contemporary languages that are serious about concurrency support 
atomic primitives one way or another. We must too. There's no two ways 
about it.

[snip]
> Side note: I still think a convenient and fairly practical solution is
> to make 'shared' things 'lockable'; where you can lock()/unlock() them,
> and assignment to/from shared things is valid (no casting), but a
> runtime assert insists that the entity is locked whenever it is
> accessed.

This (IIUC) is conflating mutex-based synchronization with memory models 
and atomic operations. I suggest we postpone anything related to that 
for the sake of staying focused.


Andrei


More information about the Digitalmars-d mailing list