On 3 Apr '08, at 9:29 AM, Richard Somers wrote:
There is a common practice of prefixing instance variable names with "_", a single underscore character.
And it's a very good idea to do so, IMHO. (The exact prefix isn't important, just as long as it's easy to distinguish ivars from local vars at a glance.)
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.
Properties and ivars are not the same thing. Properties are shorthand for methods, not variables. A property doesn't have to correspond to any instance variable, or to one with the identical name.
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.
They just didn't feel it was worth it to rewrite hundreds of existing AppKit and Foundation header files replacing all the getter/setter method declarations with the equivalent "@property"s. It doesn't really make a difference, because you can still use property syntax when referring to attributes that have getters or setters — for example "window.frame" or "string.length". I do it all the time, it saves typing and keeps me from having to count so many nested brackets.
—Jens
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ 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]