[swift-evolution] $self

Charles Srstka cocoadev at charlessoft.com
Wed Sep 28 19:58:04 CDT 2016

> On Sep 28, 2016, at 7:48 PM, Jay Abbott via swift-evolution <swift-evolution at swift.org> wrote:
> Sean, yeah that's kind of what I was suggesting for @escaping closures - it should be the default... but it is a breaking change and as Chris pointed out that would need extreme justification... plus it would be a behaviour change with no syntax change, so code that was never "upgraded" would be very difficult to tell the original intention. I like the idea but I don't know if I can come up with "extreme justification" for it.

How do reference cycles created by accidental implicit captures rank in the list of commonly encountered runtime issues? It’s gotta be high, isn’t it? Especially if you limit the scope to memory leaks—it seems every time I’ve had to track down one of those since ARC came out, it’s been either an unintended closure capture or something KVO-related.

Closures are, for me, the #1 time that I switch to super-defensive coding mode. Requiring explicit semantics to capture variables would surely reduce a lot of memory issues, and also fix crashes that could be caused by objects being deallocated in the wrong order. The quality of code in general would improve. Is that extreme? I don’t know, but I certainly wouldn’t complain if it happened.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160928/4f52b316/attachment.html>

More information about the swift-evolution mailing list