• 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: NSDictionary mutability test
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDictionary mutability test


  • Subject: Re: NSDictionary mutability test
  • From: Andy Lee <email@hidden>
  • Date: Mon, 08 Dec 2008 17:39:15 -0500

On Dec 8, 2008, at 5:15 PM, Adam Leonard wrote:
But using NSDictionary as a placeholder for something that actually happens to be mutable seems fine to me if you don't want to have clients relying on the method's implementation using a mutable dictionary internally.

I'm pretty sure I have seen the Cocoa frameworks doing this.

Yup. I just did a quick test using -[NSView subviews]. The return type is NSArray*, but if you send -addSubview: to the view, the size of the previously returned array grows by 1.


I would never assume a returned array is immutable just because the declared return type of a method is NSArray*.

--Andy

_______________________________________________

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: 
 >NSDictionary mutability test (From: "email@hidden" <email@hidden>)
 >Re: NSDictionary mutability test (From: "email@hidden" <email@hidden>)
 >Re: NSDictionary mutability test (From: Sherm Pendley <email@hidden>)
 >Re: NSDictionary mutability test (From: "I. Savant" <email@hidden>)
 >Re: NSDictionary mutability test (From: Adam Leonard <email@hidden>)

  • Prev by Date: Re: NSTask
  • Next by Date: Re: NSTask
  • Previous by thread: Re: NSDictionary mutability test
  • Next by thread: Re: NSDictionary mutability test
  • Index(es):
    • Date
    • Thread