Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7871 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68448 invoked by uid 1010); 16 Feb 2004 09:39:12 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 68339 invoked from network); 16 Feb 2004 09:39:10 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 16 Feb 2004 09:39:10 -0000 Received: (qmail 11645 invoked from network); 16 Feb 2004 09:39:04 -0000 Received: from localhost (HELO zeev-laptop.zend.com) (127.0.0.1) by localhost with SMTP; 16 Feb 2004 09:39:04 -0000 Reply-To: zeev@zend.com Message-ID: <5.1.0.14.2.20040216113631.06f80cd8@localhost> X-Sender: zeev@localhost X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Mon, 16 Feb 2004 11:39:00 +0200 To: Hans Lellelid Cc: internals@lists.php.net In-Reply-To: <40305B44.20002@velum.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] extending interfaces - fringe behavior From: zeev@zend.com (Zeev Suraski) References: <40305B44.20002@velum.net> At 07:55 16/02/2004, Hans Lellelid wrote: >I have a need in a current application to extend interfaces and possibly >re-define (change signature) some of the inherited methods in the child >interface. > >e.g. > >interface Foo { > public function __construct(MyCls $var); > public function myFunction(); >} > >interface Bar extends Foo { > public function __construct(MyCls $var, $var2 = null); > public function myOtherFunction(); >} > >class A implements Bar { > public function __construct(MyCls $var, $var2 = null) { > // ... > } > public function myFunction() { > // ... > } > public function myOtherFunction() { > // ... > } >} > >This is not currently possible in PHP5b4, due to the (new?) "Can't inherit >abstract function" errors generated by the engine. I.e. if I try to >redefine __construct() I will get an error. > >The need for this capability is probably not that mainstream, but it'd be >very nice. Is there any chance of having support for this behavior? I >don't know anything about the underlying mechanism for supporting >interface extension, so I don't know if what I'm asking is trivial or not. You're not supposed to change the signature when you're extending/implementing interfaces. I'll try to see if it's feasible to improve the checks so that they compare signatures in a smarter way (i.e., func($arg1, $arg2=null) is compatible with func($arg1), and currently it's not detected that way). Zeev