On Thu, Apr 2, 2009 at 3:20 PM, Marcel Weiher <marcel.wei...@gmail.com> wrote: > > On Apr 1, 2009, at 21:44 , Michael Ash wrote: > >> On Thu, Apr 2, 2009 at 12:33 AM, Ryan Joseph >> [distinguishing between NSArray and CFArray] >> The test cannot be performed, because the question does not make any >> sense. > > While this answer is mostly true for what the original poster is trying to > accomplish (as far as I can tell), it is actually not true. > > An NSCFArray and a CFArray are indistinguishable as described, and if you as > for an NSArray, you will typically get an NSCFArray. > > However, an actual NSArray that is not an NSCFArray will be different and > distinguishable. This distinction is also not just academic, but quite > important because it is used by CoreFoundation to know wether to call its > own functions or send a message to the object in question, allowing custom > NSArray subclasses to be used in CFArray calls.
No, you're examining an entirely different question, which is whether a particular object is the built-in provided NSArray subclass or a custom subclass. Of course you can tell those apart, just like you can distinguish between an NSTextField and an NSButton. But they're *both* NSViews, and any NSArray subclass is still an NSArray. And any NSArray is also a CFArray. It may have a different implementation from the normal CFArray, but there's nothing weird about that: welcome to object oriented programming. >> An NSArray is a CFArray. A CFArray is an NSArray. You can't take one >> of them and ask which one it is any more than you can ask your friend >> whether he's Bob or Bill. They're just two names for the same thing. > > s/NSArray/NSCFArray/g No. Please, if you disagree, just state your position, don't modify mine. Mike _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com