• 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: Copy and release
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copy and release


  • Subject: Re: Copy and release
  • From: Wade Tregaskis <email@hidden>
  • Date: Sat, 23 Oct 2004 02:13:45 +1000

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:

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>)

  • Prev by Date: Re: Copy and release
  • Next by Date: Re: KVO and accessors - are they needed
  • Previous by thread: Re: Copy and release
  • Next by thread: Re: Copy and release
  • Index(es):
    • Date
    • Thread