• 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: Retain/Release and Properties clarification
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retain/Release and Properties clarification


  • Subject: Re: Retain/Release and Properties clarification
  • From: Charles Srstka <email@hidden>
  • Date: Mon, 03 Oct 2011 13:23:25 -0500

On Oct 3, 2011, at 10:14 AM, John Tsombakos wrote:

> (and will also change to use the underscore ivar names too - I had done that previously, but...well, didn't this time.)

I recommend using some other prefix system instead of the underscore, for two reasons:

1. Apple reserves the underscore prefix for their own use, so you could, at least theoretically, clash with a superclass ivar this way, and

2. KVO’s “access instance variables directly” (mis)feature recognizes the underscore prefix. I like to give it a prefix that KVO doesn’t know about so that I can be sure never to end up accidentally accessing the ivars of another object without going through the proper accessors.

3. If I use an ivar prefix that no one else uses (as far as I know), then I can make my class into a subclass of something from a publicly available framework without needing to worry about ivar name clashes.

Charles_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Retain/Release and Properties clarification
      • From: Sean McBride <email@hidden>
    • Re: Retain/Release and Properties clarification
      • From: Kyle Sluder <email@hidden>
References: 
 >Retain/Release and Properties clarification (From: John Tsombakos <email@hidden>)
 >Re: Retain/Release and Properties clarification (From: John Tsombakos <email@hidden>)

  • Prev by Date: Re: Retain/Release and Properties clarification
  • Next by Date: Re: Retain/Release and Properties clarification
  • Previous by thread: Re: Retain/Release and Properties clarification
  • Next by thread: Re: Retain/Release and Properties clarification
  • Index(es):
    • Date
    • Thread