[swift-dev] `withUnsafePointer` mutates `self`

Jordan Rose jordan_rose at apple.com
Wed Dec 16 20:35:05 CST 2015


> On Dec 16, 2015, at 0:12 , Dave Abrahams via swift-dev <swift-dev at swift.org> wrote:
> 
>> Yeah but we want to move in the direction of making that more reliable, not less.
> 
> I am not sure I agree with you.  I would defer to John McCall on this one, but my understanding is that it's an explicit non-goal to make that guarantee.
> 
>> I forget who but someone said in another thread that global variables can be reliably passed by-ref to functions that take pointers already (even though the Swift documentation does not guarantee this).

This was probably me; I say it a lot when explaining why other solutions don't work for KVO contexts. I can back Dave up that we're more likely to move away from guaranteeing persistent addresses for particular kinds of declarations. I could easily see it being an attribute of some kind, with all other declarations (including globals) never assumed to have persistent addresses. You just don't need them very often, and when you do need them you usually know it up front.

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


More information about the swift-dev mailing list