> On Feb 21, 2017, at 7:32 PM, rintaro ishizaki <fs.out...@gmail.com> wrote:
>
> lifetime guaranteed to be around until the method call completes
>
> AFAIK, this is true.
> However, in this case, it's not a method call. The lifetime is only
> guaranteed until getter:increment completes.
>
> Demo().increment(3)
> |--------------| lifetime
>
Thanks! This is an interesting explanation.
It is curious that naming the variable cases different behavior.
IOW, this doesn’t have a problem:
let demo = Demo()
demo.increment(3)
Lifetime seems to last the entire expression.
Ray
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users