Re: NSArray cluster class membership
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.