[Swift-devel] swift write once array/struct

Ketan Maheshwari ketan at mcs.anl.gov
Sat Mar 21 14:16:16 CDT 2015


Thanks Mihael, that clarifies it.

Tim, I was thinking from the point of view of avoiding deadlocks. I
understand the semantics would remain same. I was thinking a self contained
array/struct in terms of state management (may be it is called actor based
impl, not sure) would be more robust in terms of avoiding deadlocks.

--
Ketan

On Sat, Mar 21, 2015 at 12:28 PM, Hategan-Marandiuc, Philip M. <
hategan at mcs.anl.gov> wrote:

> On Sat, 2015-03-21 at 10:38 -0500, Ketan Maheshwari wrote:
> > Hi Tim,
> >
> > Thanks for the clarification and code snippet. To clarify, in my
> > understanding, the implementation is 'extrinsic'.
> >
> > To be intrinsic, I imagined the array is implemented as an object which
> has
> > a function that monitors and controls its write-once property and gets
> > invoked every time anything is written to any element of the array.
>
> The array is implemented as you describe above. I'm not really sure what
> extrinsic would be.
>
> Calls to an object's methods aren't automatically synchronized or
> atomic, so I don't think that assumption in your earlier email is
> correct.
>
> Even if they were, having this particular method atomic does not
> guarantee that there would be no deadlocks. A user can write a[0] =
> f(a[1]); a[1] = f(a[0]);
>
> Mihael
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20150321/4ead74ae/attachment.html>


More information about the Swift-devel mailing list