> On Sep 12, 2016, at 9:34 AM, Jean-Daniel <d...@xenonium.com> wrote:
> 
> Array are value based in Swift and so use COW optimization, which mean that 
> even if you don’t resize them, you may hit a race condition issue.

Yes, you’re right. The question in my mind is whether the array struct ever 
gets copied in this code — it’s not explicitly passed as a parameter, just 
closed over. I don’t think I’ve read any docs that describe explicitly what the 
behavior is, maybe because it only becomes significant when you introduce 
threads?

This situation also begs the question of what kind of lower-level data 
structure one can use in Swift when Array is too high-level. In Obj-C one can 
drop down to C arrays, for example.

Gerriet, would you mind re-asking your initial question on swift-users? I’d 
love to hear what the Swift gurus say about it.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to