• 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: Accessor methods and (auto)release <Memory trail>
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessor methods and (auto)release <Memory trail>


  • Subject: Re: Accessor methods and (auto)release <Memory trail>
  • From: Ali Ozer <email@hidden>
  • Date: Fri, 2 Aug 2002 09:10:01 -0700

So, is the above pattern (getter which retains and autoreleases) used in Cocoa at all? Or, is it just a theoretically correct, but practically for diverse reasons never (or extremely rarely) used one?

Good question... You're right that not many classes that can use this technique do right now.

As mentioned before, a few low-level classes (such as the collections, attributed string, etc) don't and won't use this technique because they are collections and don't want to fiddle with the lifetime of your objects.

Many other classes use other techniques, mostly due to the fact their set/get methods were written many years ago when we were still enumerating the techniques, still looking at the performance characteristics, and not as much aware of thread safety issues. We have actually fixed some cases in Jaguar to use this exact technique, and will probably continue to do so as long as we don't introduce any serious binary incompatibilities (which is unfortunately a serious threat)...

But, I believe that especially for people just approaching Cocoa and for anyone writing new classes, this get/set pattern is the most appropriate unless there are significant performance concerns like "getter will be called a lot".

Ali
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Accessor methods and (auto)release <Memory trail>
      • From: Marcel Weiher <email@hidden>
References: 
 >Re: Accessor methods and (auto)release <Memory trail> (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Creating a clickable (web-browser-like) URL control
  • Next by Date: Re: Private NIBs?
  • Previous by thread: Re: Accessor methods and (auto)release <Memory trail>
  • Next by thread: Re: Accessor methods and (auto)release <Memory trail>
  • Index(es):
    • Date
    • Thread