[swift-evolution] Contiguous Memory and the Effect of Borrowing on Safety
jgroff at apple.com
Wed Nov 16 11:06:27 CST 2016
> On Nov 12, 2016, at 4:19 PM, David Sweeris via swift-evolution <swift-evolution at swift.org> wrote:
>> On Nov 10, 2016, at 12:39 PM, Stephen Canon via swift-evolution <swift-evolution at swift.org> wrote:
>>> On Nov 10, 2016, at 1:30 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>>> What worries me is that if systems programmers are trying to get static
>>> guarantees that there's no ARC traffic, they won't be willing to handle
>>> a copyable thing that carries ownership.
>> FWIW, we (frequently) only need a static guarantee of no ARC traffic *within a critical section*. If we can guarantee that whatever ARC operations need to be done happen in a precisely-controlled manner at a known interface boundary, that’s often good enough.
> “Critical section” is a phrase I normally associate with multi-threaded code… Do we need to start talking about concurrency to move this topic forward?
In a sense, yeah, ARC traffic is concurrent to the explicitly-written behavior of the program, since the compiler does not make strong guarantees about when exactly retains and releases occur. Releases in particular can trigger arbitrary code execution through deinitializers. The analogy to a critical section for not wanting an arbitrary deinitializer to run within a region seems apt.
More information about the swift-evolution