Open
Description
We should support working with Objective-C protocols.
- There should be an
ObjCProtocol
class to look up protocols by name, similar toObjCClass
. -
ObjCProtocol
instances should provide basic properties like name and list of superprotocols. - Protocol conformance should be checkable using
isinstance
/issubclass
(ObjCClass should support isinstance and issubclass #68). - Objective-C subclasses created in Python should be able to conform to protocols (by adding them to the supertype list).
- This should check that all required methods and properties are implemented by the subclass. (Maybe the runtime does this already, but since it only communicates errors as boolean return values, we should provide better error messages ourselves.)
- This could be used to infer method signatures. That is, when the subclass includes a method with the same name as one in a protocol (or superclass), and the method implementation has no parameter/return annotations, the types should be inherited from the superclass/protocol.
- Users should be able to create Objective-C protocols from Python using class syntax.
- How should method declarations look? Regular Python method syntax with type annotations, and method bodies are ignored?