Re: NSDictionary mutability test
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