Re: Interface inheritance

From: Date: Tue, 20 Apr 2004 15:22:27 +0000
Subject: Re: Interface inheritance
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-9426@lists.php.net to get a copy of this message
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

« previous php.internals (#9426) next »