On 18 Jan 2011, at 11:20, Quentin Mathé wrote: > Le 17 janv. 2011 à 23:31, David Chisnall a écrit : > >> NSZombie is a root class, so its class should inherit from NSObject, > > Hm, I suppose you mean it shoudn't inherit from NSObject, right? > Or may be you mean some NSObject methods are added to NSZombie since it's a > root class and it doesn't inherit from NSObject…
No. It's class inherits from NSObject - its metaclass has NSObject's class as its superclass. >> but NSObject's -class method will return the metaclass if self is a class... > > As far I remember you can never access the metaclass with NSObject API, > NSObject has both -class and +class, but +class returns the receiver class > rather than its metaclass. > So -class and +class returns the same iirc. Correct. However, NSObject's instance methods are all class methods of other root classes because of this strange rule in Objective-C. That's why you have to be careful adding methods to NSObject. > > Here is quick F-script test I wrote on Mac OS X: >> NSObject class isEqual: NSObject new class > true >> NSObject class class isEqual: NSObject new class > true Yes, that's true for NSObject. Try it instead with some other root class (I think NSProxy implements +class itself). >> Does anyone else get this failure? It seems to work for me, but I'm not >> sure why... > > No, but currrently I'm using GCC to compile libobjc2 and GNUstep. I'm using clang and the non-fragile ABI and it works for me, but I'm confused as to why it should. David -- Sent from my Difference Engine _______________________________________________ Etoile-dev mailing list [email protected] https://mail.gna.org/listinfo/etoile-dev
