• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Toll-free bridge type at runtime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Toll-free bridge type at runtime


  • Subject: Re: Toll-free bridge type at runtime
  • From: Michael Ash <email@hidden>
  • Date: Thu, 2 Apr 2009 16:54:26 -0400

On Thu, Apr 2, 2009 at 3:20 PM, Marcel Weiher <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Toll-free bridge type at runtime
      • From: Marcel Weiher <email@hidden>
References: 
 >Toll-free bridge type at runtime (From: Ryan Joseph <email@hidden>)
 >Re: Toll-free bridge type at runtime (From: Michael Ash <email@hidden>)
 >Re: Toll-free bridge type at runtime (From: Marcel Weiher <email@hidden>)

  • Prev by Date: Re: Disabling Highlighting of Row Selection in NSTableView
  • Next by Date: Re: NSPopUpButton pullsDown:YES and dummy first item - normal?
  • Previous by thread: Re: Toll-free bridge type at runtime
  • Next by thread: Re: Toll-free bridge type at runtime
  • Index(es):
    • Date
    • Thread