[swift-evolution] Proposal: [stdlib] Remove withUnsafe[Mutable]Pointer[s]()

Jordan Rose jordan_rose at apple.com
Wed Dec 16 16:27:59 CST 2015


> On Dec 16, 2015, at 14:24 , Michael Gottesman via swift-evolution <swift-evolution at swift.org> wrote:
> 
>>> My fear about withExtendedLifetime is that the name is a misnomer. You are not extending the lifetime.
>> 
>> I assume you mean that you don't need to extend the lifetime, rather than that it's not actually extending anything (because it is, it's just technically extending the lifetime of the UnsafePointer).
> 
> No, what I am saying is that withExtendedLifetime implies some sort of special lifetime extension (otherwise, why would one specifically call it out). It is not performing any sort of special lifetime extension, it is just using the normal lifetime extension rules.

withExtendedLifetime does extend lifetime: it guarantees that the object will stay alive for the entire body of the closure, rather than being released early by ARC. It's similar to the 'objc_precise_lifetime' attribute in Clang.

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151216/0176d7ca/attachment.html>


More information about the swift-evolution mailing list