[swift-evolution-announce] [Accepted] SE-0022 Referencing the Objective-C selector of a method

Joe Groff jgroff at apple.com
Tue Jan 26 16:16:32 CST 2016


The review of SE-0022 "Referencing the Objective-C selector of a method" ran from January 18...23, 2016. The proposal has been accepted, with a modification to the proposed selector reference syntax to use `#selector(Foo.bar)`. We plan to introduce the new syntax in both 2.2 and 3.0, and we'll also deprecate the StringLiteralConvertible-ness of Selector in 2.2 to be removed from 3.0. A few alternatives came up in discussion, including:

Foo.bar // (a) implicit conversion from decl ref to Selector
Selector(Foo.bar) // (b) magic constructor from decl ref to Selector
Foo.bar.selector // (c) magic member on function decls

On balance, we didn't want to introduce type system complexities for relatively rare ObjC interop features, nixing (a) and (b). Pre-allocating the member space of function types could also have long-term problems, should functions ever gain the ability to have real members (either directly, or indirectly via protocol extensions), so (c) also feels problematic. On the other hand, we already have precedent for '#' as the "miscellaneous compiler magic" sigil, as used in #availability, and '#selector' solidifies that convention.

-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution-announce/attachments/20160126/4d93e393/attachment.html>


More information about the swift-evolution-announce mailing list