> On Sep 8, 2015, at 10:57 AM, Ben Kennedy <b...@zygoat.ca> wrote:
> 
> 
>> On 07 Sep 2015, at 5:02 pm, Graham Cox <graham....@bigpond.com> wrote:
>> 
>> Also, NSColor is immutable so there’s little purpose to having that property 
>> ‘copy’, it can be ‘retain’ (or ‘strong’) and it will save you a small amount 
>> of space per instance.
> 
> As Dave said in his reply, isn't this actually poor advice? It obscures the 
> semantic intent of the property, and likely makes no measurable difference 
> anyhow (presuming that the immutable class implements copy as retain).

I would say that in general if something is copy-able, then you should copy it 
unless you have a really really good reason to do otherwise. Generally objects 
that implement copying are value objects rather than identity objects, and 
copying is generally the right thing to do for those.

If there is a performance issue in doing so, you should either file a bug (for 
SDK classes) or implement -copyWithZone: (for your own).

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

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

Reply via email to