On Tue, Apr 09, 2002 at 11:11:58AM +0200, Marcus B?rger wrote:
> Keywords are better then implicit definitions.
Agreed.
> I would like to have private, protected and public which can
> be easily done by adding one single flag to the members of an
> object.
So how would you set or reset these flags at run-time?
> With friends implementation may be much harder because each
> class or even object has to have a friends list.
Why would friend be necessary in the first place, when you
simple could
class A {
private $slot;
}
class B {
function do_with_an_A(&$someA) {
@$someA->slot = 10; // I know it is private and I intend to break it.
}
}
"friend" is just a compile-time declaration of a list of classes
for which you intend to break privacy, and if you can to it
anyway at run-time, you do not need such a declaration.
> >protected and friend are commonly compile-time mechanisms, so
> >they are not sufficient for us, unless you refer to an uncommon
> >case where protected() and friend() are being used as functions
> >on existing objects or classes in order to modifiy accessibility
> >attributes after object instantiation.
>
> Why are they not sufficient?
Because, again, they require a complete and finished declaration
of privacy breakage at compile time. That is lacking dynamism,
and for some more advanced applications such breakage at
run-time would be extremely handy.
> There is nothing that forbids us to save information generated
> for the compiler tree into our classes/objects and using them
> at run time.
"using" would not be enough here, "modifying" or "ignoring"
would be called for.
Kristian
--
Kristian K�hntopp, NetUSE AG, Dr.-Hell-Stra�e, D-24107 Kiel
Tel: +49 431 386 435 00, Fax: +49 431 386 435 99
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php