Hacker News new | ask | show | jobs
by solidsnack9000 3407 days ago
The Swift ownership system doesn't address concurrency because a mutable reference can be passed to a function, stored somewhere, and then passed to another function?
1 comments

The major holes are: class fields, globals, and captures of escaping (non-scoped) closures (which are basically class fields).

Although this system proposes dynamic checking for these cases, it's explicitly not atomic checking. Atomic checking would be very expensive even though most code doesn't need it. Also there's a general sense that java, which does atomically guard all shared mutable state, has the problem that these accesses are defined but ultimately useless. Part of this is that coherent updates require coarser locks.

Maybe for objects it makes more sense to be able to "own" the object as a whole, if I am understanding you right. Still reading the Swift proposal.