Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copy and release



What I thought I was saying was that, if you need a mutable copy because you need to change it, you'd make one (probably by calling mulatbleCopy). If you didn't you store a reference (probably returned from retain). It doesn't matter if the class your working on is mutable or not.

If everything was mutable, you should be incurring extra costs because of unnecessary copies. Your code should only copy when it's necessary.

Yes. As I mentioned, either you enforce a mutable parameter by specifying it as the parameter type (e.g. NSMutableString* instead of NSString*), or you call isKindOfClass:[NSMutableWhatever class] on the parameter, as a runtime check. You can then either retain or mutableCopy it as appropriate.

To be honest I didn't actually pick up this thread at it's start, so I'm not sure what the original poster's question or whatever was, but if it was something along the lines of the need for a "mutableVersion" method (which copies or type-casts & retains as appropriate), then it's probably got some potential... but then, there'd need to be proof that it's worth the extra effort, in terms of implementation and transition from older code.

Wade Tregaskis (AIM, Yahoo & Skype: wadetregaskis, ICQ: 40056898, MSN & email: email@hidden, Jabber: email@hidden
-- Sed quis custodiet ipsos custodes?

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Copy and release (From: Nicko van Someren <email@hidden>)
 >Re: Copy and release (From: Evan Schoenberg <email@hidden>)
 >Re: Copy and release (From: Nicko van Someren <email@hidden>)
 >Re: Copy and release (From: Paul Sargent <email@hidden>)
 >Re: Copy and release (From: Wade Tregaskis <email@hidden>)
 >Re: Copy and release (From: Paul Sargent <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.