On Thu, Apr 3, 2008 at 9:29 AM, Richard Somers <[EMAIL PROTECTED]> wrote: > There is a common practice of prefixing instance variable names with "_", a > single underscore character. > > If Objective-C 2.0 properties are used this would result in dots followed > by underscores when invoking accessor methods with the dot syntax. Not a > desirable situation. > > It appears that Apple as of Mac OS 10.5 uses properties only in Core > Animation classes and NSPointerFunctions.h with CALayer.h being the single > biggest user. Nowhere when Apple uses properties does it also prefix > instance variables with an underscore that I can find. Note that > NSPointerFunctions.h contains some very interesting property examples. > > It would appear then that the practice of practice of prefixing instance > variable names with an underscore character is becoming a historical relic > of the past. > > Any comments?
There's no reason that the property's name need match the instance variable's name exactly: @interface MyObject : NSObject { id _ivar; } @property ivar; @end @implementation MyObject @synthesize ivar=_ivar; @end -- Clark S. Cox III [EMAIL PROTECTED] _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]