On 15 November 2012 17:17, Andrei Alexandrescu <span dir="ltr"><<a href="mailto:SeeWebsiteForEmail@erdani.org" target="_blank">SeeWebsiteForEmail@erdani.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 11/15/12 1:08 AM, Manu wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On 14 November 2012 19:54, Andrei Alexandrescu<br></div>
<<a href="mailto:SeeWebsiteForEmail@erdani.org" target="_blank">SeeWebsiteForEmail@erdani.org</a> <mailto:<a href="mailto:SeeWebsiteForEmail@erdani.org" target="_blank">SeeWebsiteForEmail@<u></u>erdani.org</a>>><div class="im">
<br>
wrote:<br>
    Yah, the whole point here is that we need something IN THE LANGUAGE<br>
    DEFINITION about atomicLoad and atomicStore. NOT IN THE IMPLEMENTATION.<br>
<br>
    THIS IS VERY IMPORTANT.<br>
<br>
<br></div><div class="im">
I won't outright disagree, but this seems VERY dangerous to me.<br>
<br>
You need to carefully study all popular architectures, and consider that<br>
if the language is made to depend on these primitives, and the<br>
architecture doesn't support it, or support that particular style of<br>
implementation (fairly likely), than D will become incompatible with a<br>
huge number of architectures on that day.<br>
</div></blockquote>
<br>
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.<br>
<br>
[snip]<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Side note: I still think a convenient and fairly practical solution is<br>
to make 'shared' things 'lockable'; where you can lock()/unlock() them,<br>
and assignment to/from shared things is valid (no casting), but a<br></div>
runtime assert insists that the entity is locked whenever it is<br>
accessed.<br>
</blockquote>
<br>
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.</blockquote><div><br></div><div>I'm not conflating the 2, I'm suggesting to stick with the primitives that are already present and proven, at least for the time being.</div>
<div>This thread is about addressing the problem in the short term, long term plans can simmer until they're ready, but any moves in the short term should make use of the primitives available and known to work, ie, don't try and weave in language level support for architectural atomic operations until there's a thoroughly detailed plan, and it's validated against many architectures so we know what we're losing.</div>
<div>Libraries can already be written to do a lot of atomic stuff, but I still agree with the OP that shared should be addressed and made more useful in the short term, hence my simplistic suggestion; runtime assert that a shared object is locked when it is read/written, and consequently, lift the cast requirement, making it compatible with templates.</div>
</div></div>