Objective-C interoperability: Eliminate NSObjectProtocol

Source compatibility update

The fallout from this change is not too bad. There are effectively two kinds of failures we see in the source compatibility suite:

  1. Explicit use of responds(to:) on a value of a protocol type that has (now suppressed) inheritance from NSObjectProtocol, e.g., this example from RxDataSources:
    let forwardDelegateResponds = (self.forwardToDelegate() as? UITableViewDataSource)?.responds(to: commitForRowAtSelector)
    
  2. Extensions of NSObjectProtocol, e.g., this example from ReactiveCocoa:
    extension NSObjectProtocol {
      @nonobjc internal var associations: Associations<Self> {
        return Associations(self)
      }
    }
    

Neither has an "obvious" fix within the language. For #2, one could perhaps treat extension NSObjectProtocol as extension NSObject, but while that would make this extension work... it has clients that would need to be updated to use NSObject as well:

extension Reactive where Base: NSObjectProtocol { ... uses associations ... }

If we were to extend Swift further, to allow extensions of AnyObject, it would make #2 "just work" (all class types would get this behavior), and #1 could be fixed by extending AnyObject with the relevant parts of NSObjectProtocol's API. But, that's a significant language extension on which to gate this proposal.

Doug