Re: [Pyobjc-dev] objc classes
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2004-05-29 05:35:14
|
On 28-mei-04, at 23:47, Bob Ippolito wrote: > > 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. Exactly, the reason for this is efficient thread-safety. > >> 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? It is not possible with PyObjC. It might be possible with the Apple ObjC runtime, but would be pretty hard using the GNUstep runtime (that one definitely maintains a list of subclasses). > > 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 This limitation may be liften in a future version of PyObjC. Reloading can be useful during development. > > Some of the things you ask about are possible though awful hacks, but > I'm not going to encourage that :) > > -bob > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle > 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > -- X|support bv http://www.xsupport.nl/ T: +31 610271479 F: +31 204416173 |