• 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: Marcel Weiher <email@hidden>
  • Date: Thu, 2 Apr 2009 16:24:17 -0700


              NSArray
           /              \
 NSCFArray    MYNSArray

From the Objective-C perspective, there is no such thing as NSArray;

Sure there is.

it is a class cluster,

So apart from being a class cluster (which is also "something" and not "no thing") it is also an actual class.


and any object that implements the required
methods can be treated as an NSArray; NSCFArray meets that criteria,
as does a custom subclass of NSArray; they are all NSArrays.

Exactly. See diagram above. However, MYNSArray !isa NSCFArray.

Allowing your logic, just about any two classes would actually be
equivalent, because virtually all of them have NSObject as a common
ancestor.

If they implement the same methods and provide the same functionality, then they *are* equivalent. If it walks like an NSArray and quacks like an NSArray it *is* an NSArray.

This is not true. Equivalence (under some relationship) is not the same as identity. Why is this so difficult?


The compatibility that you see and that is confusing you is not due to the
fact that there is an isa relationship, but due to non-isa compatibility and
lots of hard-coded work.

Yes, but that hard-coded work is an implementation detail to *provide* the isa compatibility.

*compatibility* not equality. Once again, the system goes to quite a few lengths so these *different things* can be used interchangeably in certain situations. However, that doesn't mean they aren't different and that you cannot tell them apart. They are different and it is easy to tell them apart when needed. It is also (fortunately) easy to treat them the same in many useful situations.


Cheers,

Marcel

_______________________________________________

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


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>)
 >Re: Toll-free bridge type at runtime (From: Michael Ash <email@hidden>)
 >Re: Toll-free bridge type at runtime (From: Marcel Weiher <email@hidden>)
 >Re: Toll-free bridge type at runtime (From: Clark Cox <email@hidden>)

  • Prev by Date: Re: Non-pageable app
  • Next by Date: Re: Toll-free bridge type at runtime
  • Previous by thread: Re: Toll-free bridge type at runtime
  • Next by thread: Re: Toll-free bridge type at runtime
  • Index(es):
    • Date
    • Thread