The current OO implementation of ZE2 only allows dynamically
binding of methods. That is all functions are inherited like if they
were declared "virtual" in other languages.

The thing we do not have is static binding of methods. First one
could argue that we do not have a type system and ....

On the other hand there is a need for static binding since it allows
us to declare functions that are *invariant* against inheritance.
That is especially usefull for things like a standard class library (what
ADT might become hopefully) or even your own standard class
collection.

Consider you defined a container (list, vector what ever) and want
to derive from it. Then there is *really*no* need to override methods
like "insert" or "remove". You may want to have additional things like
"insert_if" or whatever. But for the container part "insert" must stay as
it is and that requires static binding.

And here comes "final" as it allows to emulate static binding with
dynamic binding. If you declare a function "final" it is invariant
against inhertance starting from that point in the inhertance tree. In
other words it is even more powerfull than pure static binding and as
a side effect it eliminates the problem that someone overrides erm
redeclares a static bound function beeing inherited.

A patch can be found here:
http://marcus-boerger.de/php/ext/ze2/

regards
marcus

p.s.: It would be nice to reach a consensus here soon because i want
to start another extension to the OO model - if you read between the
lines you may guess but it'l have to wait...





--
----------------------------------------------------------------------
Marcus Börger - Looking for all sorts of freelance work - just ask...

Did i help you? Consider a gift:
http://www.amazon.de/exec/obidos/wishlist/ho722v0rg1u0
----------------------------------------------------------------------


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

Reply via email to