Marcus Börger wrote:
> -> we have private, what about final, public, protected and
> abstract (can we remove/hide a method from an object)?

Do we in ZE2? What use it is?

In my book, private is only of very limited use, because there
always must be a way around it. 

Introducing private (in C++) immediately called for the
introduction of protected and friend, with protected being a
mechanism to break privacy along the lines of the inheritance
hierarchy and friend being a mechanism to break privacy across
inheritance hierarchies, at compile time.

Since PHP does many things at run time which C++ does at compile
time, there must be a mechanism to break privacy at run time,
which makes it pretty pointless to have private variables in the
first place.

I'd rather go for a warning that is being triggered whenever I
access $a->_slot, but not when I access $this->_slot ("Access to
private object member"). I could suppress this warning by writing
$a->_slot as @$a->_slot instead.

Providing stronger privacy would only force the addition of even
more syntactic candy (such as a get_private($o, $slot) and
set_private($o, $slot)). Functions to break privacy are needed 
in order to write Metafunctionality such as a serialization
agent, or a RPC proxy like the Soaping mixin class I introduced
in another mail to this list.

> -> do we allow to reduce visability (replace protected by
> private as long as we don't have it):
>   class A {
>     public function f()..
>   }
>   class B extends A {
>     protected function f()...
>   }

Same reasoning as above. Make it a warning, do not delve into B&D
language realms. PHP does things at run time, because we are in
the rapid prototyping area and flexibility comes before compile
type checking and static bindings. And anyway, class != type in
PHP.

Kristian

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to