hi all,

> I'm personally in favour of having MI in PHP, with the serious alternative 
> being interfaces. I have failed to understand what interfaces would mean 
> in a language such as PHP, though, while I can see the clear hands-on use 
 > for MI.

1) the whole concept of interfaces as they are in Java can be thought of
as a *subset* of the functionality of MI (when combined with abstract
classes), and that being said, it is obvious that everything that can
be done with interfaces, can also be done with MI by inheriting
from abstract classes (as you would in C++). but with MI you can do
even more - you can multiply inherit implementation. so, why cut off
possibilities? i agree with Zeev here, MI is definitely superior to interfaces.

2) interfaces lose their meaning in a loosely-typed language such as PHP,
which is so dynamic that no attribute nor method declarations are
required in order to write code around an object. interfaces are nothing but
abstract classes, which do not allow implementation or instantiation.
but you do not even have abstract classes in PHP - the compiler doesn't
prevent you from trying to call a method that isn't there... the error pops up
as late as at runtime. in PHP, object interfaces only exist in the heads of the
programmers, not in the compiler, they just aren't there. this way, it doesn't
matter if programmers draw interfaces on sand using UML in order to
communicate with each other, PHP compiler does not need to know about
interfaces. therefore, interfaces really do sound kind of silly in the context
of the PHP language.

regards,
lauri



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

Reply via email to