[Pyobjc-dev] Reusing code in ObjC mappings
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2003-11-14 16:46:06
|
I've noticed that it's rather frequent for both a class and instance method to have a near identical signature and a near identical mapping.. for example, initWithBytes:length: vs dataWithBytes:length: The only difference is really in one line of code.. the class method will say: PyObjC_InitSuperCls(&super, PyObjCSelector_GetClass(method), PyObjCClass_GetClass(self)); and the instance method will say: PyObjC_InitSuper(&super, PyObjCSelector_GetClass(method), PyObjCObject_GetObject(self)); There has to be a better way than this, so that we don't have all this cut+paste code to maintain. Ideas? -bob |