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...

> FB>>What if Impl::doSomething() would accept exactly two 
parameters, but
> FB>>expects them to be arrays?
> 
> Then how can you say it implements B where object is required? 

I meant to change Impl to accept arrays and to drop the B 
implementation.

> 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...

-- 
Ferdinand Beyer
<[EMAIL PROTECTED]>

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

Reply via email to