discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dia2code objc


From: Nicola Pero
Subject: Re: dia2code objc
Date: Tue, 26 Mar 2002 15:55:43 +0000 (GMT)

> but how do we protect a member variable, assuming 'protected' means that the 
> variable is only accessible by certain objects? i was hoping there was a 
> simple default way to check whether a calling class is a 'friend' allowed to 
> access protected members, or perhaps this could be a chance to check wether 
> that would be useful a concept to have in gnustep.
> 
> > methods. Usually you would just put them into a 'separate' category.
> 
> putting the private methods into a separate category does not make the 
> compiler enforce privacy, correct?

Well ... if the private methods are in a separate category .h file which
the developer has no access to (since it's not installed with the other .h
files) [or even better, if the category declaration is in the .m file
itself], he likely will never know about the methods unless he gets them
using objdump etc, so he can't access them.  Even if he happens to know
about them, he won't misunderstand them for public ones.  He will have to
use hacks to access them ... at least declaring them manually or such ...
which is enough of a guarantee that he really knows it's private stuff and
he really thinks it's the only way for him to do what he needs.

'protecting' in the sense that there is no way for you to execute that
code is not really meaningful or possible in C/ObjC ... you have pointers,
you have access to the ObjC runtime internals ... which are terribly
useful tools in some situations, and allow very pretty and very advanced
OO tricks which might require access to the private stuff in objects
anyway.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]