On Nov 19, 2010, at 10:00 AM, Keary Suska wrote:

> So, I think we should write code to guarantee immutability to the caller, 
> regardless of type of course, which is the API contract you spell out. I see 
> the easiest way as always returning a copy in the getter. But I don't 
> remember how synthesized accessors are implemented on the back-end, so I 
> don't know if they do the smart thing by default...


If you require a mutability guarantee, it is always safe to create your own 
copy after the fact. Best case you were returned an immutable object and it is 
just a retain, worst case it was a mutable object that wouldn't have been 
modified anyway.
--
David Duncan

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to