[Pyobjc-dev] posing
Brought to you by:
ronaldoussoren
From: <bb...@ma...> - 2003-01-18 01:15:04
|
I committed a test case that tests if poseAsClass: allows a Python implemented subclass of an Objective-C object to pose as the Objective-C superclass. It currently doesn't because Python based subclasses of Objective-C classes *always* add at least one instance variable. Causes a fatal error. Specifically (from class-builder.m): /* We add 1 instance variable to hybrid objective-C/Python classes, this * contains the reference to the python half of the class. Name should be * not be used by Objective-C classes that are not managed by PyObjC... */ static char pyobj_ivar[] = "__pyobjc_obj__"; I'm going to try modifying the way this all works a bit. Specifically: - add the method +(BOOL)__pyobjc__hasPythonImplementation to NSObject; returns NO. - add the same method to all "mixed" classes as the class is created in class-builder.m It will return YES. - eliminate pyobj_ivar from class-builder.m entirely End result; no additional ivar in Python subclasses of ObjC classes. This *should* be enough to make posing work. It will likely also be a step in the right direction for categories. b.bum |