Skip to content

Protocol support #69

Open
Open
@dgelessus

Description

@dgelessus

We should support working with Objective-C protocols.

  • There should be an ObjCProtocol class to look up protocols by name, similar to ObjCClass.
  • 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew features, or improvements to existing features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions