[swift-evolution] Type-safe selectors

Joe Groff jgroff at apple.com
Sat Dec 5 09:31:38 CST 2015


> On Dec 5, 2015, at 7:29 AM, Michel Fortin <michel.fortin at michelf.ca> wrote:
> 
> Le 5 déc. 2015 à 10:17, Joe Groff <jgroff at apple.com> a écrit :
>> The receiver doesn't have to inherit NSObject. Pure Swift classes on Darwin are id-compatible and can have categories as well.
> 
> Does that mean that the compiler has to write two categories? one for NSObject and one for the root Swift class?

If the selector is expected to exist on an arbitrary `id`, maybe. If it only needs to exist on its `Self` type, it seems to me we can emit the category onto the specific class.

-Joe


More information about the swift-evolution mailing list