Skip to content

Should ObjCClass stay a subclass of type? #70

Open
@dgelessus

Description

@dgelessus

At the moment ObjCClass extends ObjCInstance and type. As far as I can tell, the fact that it extends type is not used or needed for anything at the moment. A metaclass don't need to subclass type, it's enough to have its constructor accept the signature of type's constructor (name, bases, namespace).

It's also misleading, because users might expect to be able to define Python methods on Objective-C classes (by not decorating them with @objc_method). This is not possible at the moment, because instances of user-defined Objective-C classes are actually instances of ObjCInstance, and not of the user's ObjCClass subclass. We could theoretically support this though - similar to how an ObjC NSArray becomes a Python ObjCListInstance, we could make an ObjC UserSubclass become a Python UserSubclass too. (The logic in ObjCInstance._select_mixin would probably need to be optimized though, I don't think a chain of isKindOfClass: scales well.)

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