On 26/05/2010, at 11:10 PM, vincent habchi wrote:

> So, tell me if I'm wrong, but I infer from your answer that whatever I can 
> do, there is no means for a subclass A' to access any private variable of its 
> ancestor.

Correct, if class A has not declared an accessor to it, and you haven't added 
one via a category (thanks Roland).

> Well, as a regular Python code writer, I've never missed @private (or even 
> @protected) declarations. I fail anyhow to grasp the relevancy of @private 
> vis-à-vis @protected: It seems logical to me that subclasses be granted 
> access to all ancestor attributes.

For yourself it might not be all that useful, after all you know how your own 
code works (well, sometimes ;-) and are not tempted to abuse it without 
thought. For code that you release to a wider audience, it is useful in that it 
eliminates an easy form of abuse that you likely didn't consider in your 
design. Anything you can do to encourage (or force) a user of your code NOT to 
take the wrong path is a useful tool to employ. Just decalring certain ivars 
@private sends the message to the next developer: "don't touch these".

--Graham


_______________________________________________

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 arch...@mail-archive.com

Reply via email to