Re: Mutable and immutable class cluster implementation / "method swizzling" question
Re: Mutable and immutable class cluster implementation / "method swizzling" question
- Subject: Re: Mutable and immutable class cluster implementation / "method swizzling" question
- From: Sherm Pendley <email@hidden>
- Date: Fri, 25 Mar 2011 11:28:09 -0400
On Fri, Mar 25, 2011 at 1:30 AM, Louis Gerbarg <email@hidden> wrote:
> The corner case you mention below ( [myMutableArrayInstance isKindOfClass:[NSMutableArray class]] ) is a nonissue for a somewhat surprising reason. All instances of NSArray are actually implemented via the concrete class NSCFArray, which is a subclass of NSMutableArray. Thus any instances of mutable or immutable arrays return YES to isKindOfClass for both NSArray and NSMutableArray. The only time that is not true is when people implement custom subclasses of NSArray. Thus no one can depend on that particular construct working unless they have implemented their own subclasses.
>
> For that reason, you can probably completely ignore the issue.
I agree. When bridging Perl's array & hashes, I didn't even bother
creating an immutable class. A mutable array can be passed to any
method that expects an array, and such a method is more or less
obligated by practical concerns to treat it as the declared type.
sherm--
sherm--
--
Cocoa programming in Perl:
http://camelbones.sourceforge.net
_______________________________________________
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