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

Félix Cloutier felixcca at yahoo.ca
Tue Jan 19 17:47:48 CST 2016


What was the discussed design?

It seems to me that if Swift has a CustomSelectorLiteralConvertible protocol that had a required init(selectorLiteral: String) method, it shouldn't be heroically difficult to disambiguate between a string and a method reference.

Félix

> Le 19 janv. 2016 à 18:01:11, Joe Groff via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> 
>> 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.
> 
> -Joe
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

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


More information about the swift-evolution mailing list