• 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: NSArray cluster class membership
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArray cluster class membership


  • Subject: Re: NSArray cluster class membership
  • From: Allan Odgaard <email@hidden>
  • Date: Tue, 2 Mar 2004 23:43:28 +0100

On 2. Mar 2004, at 22:51, Marco Scheurer wrote:

It's still shocking from a semantic point of view, and I'm not sure what would be lost if [[NSArray array] isMemberOfClass:[NSArray class]] returned YES, but OK, maybe it's a price to pay for clusters.

The "problem" is that there is only one array implementation, so [NSArray array] will return a mutable array, but with some ivar set to throw an exception on mutating methods.

So the result of [NSArray array] isKindofClass:[NSArray class] and the result of [NSMutableArray array] isKindofClass:[NSMutableArray class].

The problem is that immutable array is *also* kindOfClass mutable array, and thus responds to the addObject selector, but will throw an exception.

Are you suggesting Apple overload the isKindOfClass and respondsToSelector to return NO for the immutable array when asked about mutable stuff? I guess that would make sense...
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >NSArray cluster class membership (From: Marco Scheurer <email@hidden>)

  • Prev by Date: Re: API for examining Quicktime Movies
  • Next by Date: Re: Accepting url drags directly from safari
  • Previous by thread: NSArray cluster class membership
  • Next by thread: Re: NSArray cluster class membership
  • Index(es):
    • Date
    • Thread