<div dir="ltr"><div>Also, if you're curious about semantics of Swift data structures I've been doing some work on that recently, would be happy to talk about it in more detail.<br><br></div>- Tim<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 21 March 2015 at 10:06, Tim Armstrong <span dir="ltr"><<a href="mailto:tim.g.armstrong@gmail.com" target="_blank">tim.g.armstrong@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Ketan,<br></div>  I'm not sure that I fully understand the distinction between internal/external implementation.  In terms of externally observable behaviour, writing an already written cell will cause a runtime error immediately.  There's no way you can cause a deadlock or observe inconsistent values.  Deadlocks with array cells should only happen if something is waiting for a cell that has been assigned 0 times.<br></div><div><div style="margin-left:40px"><br></div>If you're curious, i copied and pasted the relevant code fragment for Swift/T (it's in data.c in lb).  It's relatively straightforward, even though it's handling a few cases.  Essentially it's <span style="font-family:monospace,monospace">if (A[i] exists) return error code;</span>.  The data structure is only accessed by a single thread so no race conditions are possible.<br><br>I believe there's something similar in swift/k.<br></div><div><br></div>- Tim<br><div><br><span style="font-family:monospace,monospace">      // Does the link already exist?<br>      adlb_container_val t = NULL;<br>      bool found = container_lookup(c, curr_sub, &t);<br><br>      if (found && (value == NULL || t != NULL))<br>      {<br>        // Can overwrite reserved (unlinked) entries with actual data, but<br>        // cannot double reserve entries.<br><br>        // Don't print error by default: caller may want to handle<br>        DEBUG("already exists: "ADLB_PRIDSUB,<br>              ADLB_PRIDSUB_ARGS(id, d->symbol, subscript));<br>        return ADLB_DATA_ERROR_DOUBLE_WRITE;<br>      }</span><br></div><div><span style="font-family:monospace,monospace">      // Following code actually assigns the array cell<br>      ...</span><br></div><div><br><br><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On 20 March 2015 at 23:33, Ketan Maheshwari <span dir="ltr"><<a href="mailto:ketan@mcs.anl.gov" target="_blank">ketan@mcs.anl.gov</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi,<div><br></div><div>So, in the meeting today, I was curious about wether the Swift write once array/struct property is enforced via some external function or is it intrinsic to the array/struct. </div><div><br></div><div>In other words, is  the array/struct implemented in such a way that it will automatically not allow anything to write once its i-th item has been written or some external entity keeps track of this property and gets triggered every time a write happens.</div><div><br></div><div>I thought with intrinsic property, write operations will be atomic and free of deadlocks as opposed to externally tracked/enforced property.</div><div><br></div><div>--</div><div>Ketan</div></div>
<br></div></div>_______________________________________________<br>
Swift-devel mailing list<br>
<a href="mailto:Swift-devel@ci.uchicago.edu" target="_blank">Swift-devel@ci.uchicago.edu</a><br>
<a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>