[swift-evolution] [Review] SE-0022: Referencing the Objective-C selector of a method

Joe Groff jgroff at apple.com
Tue Jan 19 17:01:11 CST 2016

> On Jan 19, 2016, at 2:56 PM, Jacob Bandes-Storch <jtbandes at gmail.com> wrote:
> Is it any more feasible to allow
>     let sel: Selector = UIView.insertSubview(_:belowSubview:)
> than it is to allow
>     let sel = Selector(UIView.insertSubview(_:belowSubview:))
> ?

It is in fact somewhat easier; we do similar things for things like block and C function pointer conversions, where we allow an implicit conversion but then do a pass to see whether the thing we reference makes sense to reference as a function pointer. However, Doug balked at making this an implicit conversion, due to the ObjC-specificness and relative rarity of selectors. Implicit conversions tend to have hard-to-predict secondary costs.


More information about the swift-evolution mailing list