[swift-evolution] Allow Selectors to be used as Closures

Joe Groff jgroff at apple.com
Fri Dec 4 14:18:56 CST 2015


On Dec 4, 2015, at 11:26 AM, David Smith <david_smith at apple.com> wrote:
> 
> The other concern with patterns like this is that they tend to lead to reference cycles due to unintentional closure capture.

We could do something with selectors similar to what we do with C function pointers and limit them to taking closures that take no context. We could do this by having a '@convention(objc_selector)' or something like that that represents a context-free (Self: class) -> Args -> Return function type as a selector pointer; invoking it emits objc_msgSend.

-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151204/cc0d5e5c/attachment.html>


More information about the swift-evolution mailing list