• 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: _iVar prefixes (was Re: Draggable buttons)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: _iVar prefixes (was Re: Draggable buttons)


  • Subject: Re: _iVar prefixes (was Re: Draggable buttons)
  • From: Bill Cheeseman <email@hidden>
  • Date: Mon, 04 Feb 2002 12:31:40 -0500

on 02-02-04 12:11 PM, Erik M. Buck at email@hidden wrote:

>> 1: Where is this written down?
> I don't know where in Apple's documentation. It was a prominent notice in
> the Openstep days. I believe the Openstep specification even states this.

Here's a message from Apple's Mike Ferris posted to the macosx-dev list on
Nov 11, 2000:

Here's one that may generate controversy...

Prefixing methods with "_" to indicate private methods is reserved for
Apple's use. Same goes for exported functions (for static functions, go
nuts).

If everyone uses this "_" convention it is bad because subclasses can
override an existing private method with one of their own without knowing
it. This could obviously wind up having really nasty consequences.

In my own non-Apple code, I try to make private methods start with
"<Prefix>_" where <Prefix> is the prefix I am using for that project like
"TE" for TextExtras. Yes, it is ugly to have methods like
TE_myPrivateMethod:, but it is only ugly internally since they are private
methods.

Now, for ivars, this is less of an issue since I am pretty sure the compiler
will complain if you wind up duplicating an ivar name from one of your
ancestor classes.

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com

The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont - http://members.valley.net/croquetvermont


References: 
 >Re: _iVar prefixes (was Re: Draggable buttons) (From: "Erik M. Buck" <email@hidden>)

  • Prev by Date: Re: _iVar prefixes (was Re: Draggable buttons)
  • Next by Date: Re: Finding the path that my Application is running in
  • Previous by thread: Re: _iVar prefixes (was Re: Draggable buttons)
  • Next by thread: Re: Draggable buttons
  • Index(es):
    • Date
    • Thread