Hi!

> Simply because your object responds to all the same methods of, for 
> example, the FooInterface, does not make it a FooInterface subtype.  It 
> just means that in the "duck typing" sense of the phrase, it can act 
> like a FooInterface for people that are not necessarily concerned that 
> it's actually not is_a() FooInterface.

Excellent point here. I have a feeling that with these proposals people
want to eat a cake and have it too. To have strictly defined typing
structure enforced by strict parameter checks, instanceof checks, etc.
and at the same time have the freedom of duck typing. I don't think it's
going to work well - if you want duck typing, that's one thing, if you
want class hierarchy, that's another thing. Both are viable models for
different cases, but I don't see how they can work using the same
operators and language constructs. They should be distinct.

Now, we could probably make duck typing a bit easier by allowing to
check if specific object can respond to specific interface. But I'm not
sure if it's worth the effort - why not just have it implement the
interface then? In any case, I think duck typing improvement may be a
good place for proposals, but let's not confuse it with inheritance
hierarchy.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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

Reply via email to