rubicon-objc icon indicating copy to clipboard operation
rubicon-objc copied to clipboard

Protocol support

Open dgelessus opened this issue 6 years ago • 1 comments

We should support working with Objective-C protocols.

  • [x] There should be an ObjCProtocol class to look up protocols by name, similar to ObjCClass.
  • [x] ObjCProtocol instances should provide basic properties like name and list of superprotocols.
  • [x] Protocol conformance should be checkable using isinstance/issubclass (#68).
  • [x] 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.
  • [x] Users should be able to create Objective-C protocols from Python using class syntax.
    • [x] How should method declarations look? Regular Python method syntax with type annotations, and method bodies are ignored?

dgelessus avatar Sep 17 '17 00:09 dgelessus

There's an overlap here between Objective-C protocols and Python ABCs - that might be a direction to take for implementation.

freakboy3742 avatar Sep 17 '17 01:09 freakboy3742