[swift-users] Understanding pass-by-value

Joe Groff jgroff at apple.com
Fri Nov 4 12:25:44 CDT 2016


> On Nov 4, 2016, at 10:12 AM, Rien via swift-users <swift-users at swift.org> wrote:
> 
> 
>> On 04 Nov 2016, at 17:48, Ryan Lovelett <ryan at lovelett.me> wrote:
>> 
>>> I often end up “printing” the addresses or using GDB to take an inside
>>> look.
>> 
>> That is a really simple interrogation technique I wish I had thought of
>> that! Thank you!
>> 
>>> One thing that tripped me up: if you use inout variables, the observers
>>> will be triggered once the function completes. Even if the function never
>>> changed the data referred to. (This is now documented behaviour)
>> 
>> Could you provide a link to such documentation? I think that would be
>> interesting to read.
> 
> https://developer.apple.com/library/prerelease/content/documentation/Swift/Conceptual/Swift_Programming_Language/Properties.html#//apple_ref/doc/uid/TP40014097-CH14-ID254
> 
> Check the last ‘note’ in the Property Observer section.
> You can also follow the link in there for more.

There's also some deeper documentation about the accessor model in the compiler, here:

https://github.com/jckarter/swift/blob/master/docs/proposals/Accessors.rst <https://github.com/jckarter/swift/blob/master/docs/proposals/Accessors.rst>

-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161104/06ee3dc7/attachment.html>


More information about the swift-users mailing list