Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should ObjCClass stay a subclass of type? #70

Open
dgelessus opened this issue Sep 17, 2017 · 0 comments
Open

Should ObjCClass stay a subclass of type? #70

dgelessus opened this issue Sep 17, 2017 · 0 comments
Labels
enhancement New features, or improvements to existing features.

Comments

@dgelessus
Copy link
Collaborator

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features.
Projects
None yet
Development

No branches or pull requests

2 participants