Re: [Pyobjc-dev] objc classes
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2004-05-28 21:47:21
|
On May 28, 2004, at 4:57 PM, Helge Hess wrote: > just found that in class-builder.h: > ---snip--- > * Note that it is not possible to remove classes from the > Objective-C > * runtime (at least with the Apple runtime, not sure about the GNU > runtime). > ---snap--- > > I would love to understand what exactly is meant here and how it > restricts functionality. Does that only mean that the class structure > may not be deallocated and cannot be unlinked? Yes and yes. > Is it possible to change the mapping of a class name in the name > registry (name to structure) mapping? So that the old class object is > still available, but the new class object will be used for new > instances? No and No. > Further, would it possible to change the class hierarchy of an > existing class? So that MyFormatter initially inherits from say > NSFormatter and after reloading a Python module inherits from > NSDateFormatter. Would that be possible with the Apple ObjC runtime or > is this already possible with PyObjC? No, no, and no. In fact, you can't even reload the python module. The class can be created once and only once. >>> from Foundation import * >>> class Foo(NSObject): ... pass ... >>> class Foo(NSObject): ... pass ... Traceback (most recent call last): File "<stdin>", line 1, in ? objc.error: Class already exists in Objective-C runtime Some of the things you ask about are possible though awful hacks, but I'm not going to encourage that :) -bob |