Le 18 janv. 2011 à 12:27, David Chisnall a écrit : > 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.
Ah right, I forgot how the top of the hierarchy is set up. >>> 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. I wonder if it wouldn't be cleaner to support distinct multiple hiearchies instead of a single one rooted in NSObject. This could be break some code that adds methods to NSObject and call them on NSProxy instances, but this is not a common use though. Cheers, Quentin. _______________________________________________ Etoile-dev mailing list [email protected] https://mail.gna.org/listinfo/etoile-dev
