• 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: Mutable and immutable class cluster implementation / "method swizzling" question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Mutable and immutable class cluster implementation / "method swizzling" question (From: John Engelhart <email@hidden>)
 >Re: Mutable and immutable class cluster implementation / "method swizzling" question (From: Louis Gerbarg <email@hidden>)

  • Prev by Date: Filter effects outside a CALayer
  • Next by Date: Re: iOS - Hide Master view in a split view
  • Previous by thread: Re: Mutable and immutable class cluster implementation / "method swizzling" question
  • Next by thread: Re: Mutable and immutable class cluster implementation / "method swizzling" question
  • Index(es):
    • Date
    • Thread