On Apr 20, 2004, at 11:14 AM, Ferdinand Beyer wrote:


On 20 Apr 2004 at 17:55, Stanislav Malyshev wrote:

FB>>Impl guarantees that by implementing interface A.

No. It _says_ it implements interface A, but you couldn't know if it
indeed does, if we allow your model - maybe that "dispatched"
function
call doesn't really accept those arguments?

interface I { /** Documentation says: $a is an integer, $b is a string */ function doSomething($a, $b); }

class C implements I
{
    function doSomething($a, $b)
    {
    }
}

We still can't be sure if C::doSometing() actually accepts an integer
and a string. We have to trust C. So we can also trust Impl from the
previous example...

PHP doesn't support this, regardless of you being able to tell them apart, scalar types in PHP are isomorphic.


Since PHP does not dispatch methods by parameters, I don't know
if there's
a good way to implement both A and B interfaces except making
all
doSomething definitions not accept parameters or give them
different
names.

Provided that one has access to the interfaces...

I must not understand this comment. How can you implement an interface you don't have knowledge of?


The fact is that since PHP doesn't support parameter based method dispatching, you _can't_ implement both A and B, since you can not comply with both signature contracts simultaneously.

George

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



Reply via email to