Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20249 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94814 invoked by uid 1010); 22 Nov 2005 20:48:56 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 94797 invoked from network); 22 Nov 2005 20:48:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Nov 2005 20:48:55 -0000 X-Host-Fingerprint: 204.11.219.139 lerdorf.com Linux 2.4/2.6 Received: from ([204.11.219.139:52000] helo=colo.lerdorf.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 52/25-11378-73483834 for ; Tue, 22 Nov 2005 15:48:55 -0500 Received: from [207.126.233.18] (rasmus2.corp.yahoo.com [207.126.233.18]) (authenticated bits=0) by colo.lerdorf.com (8.13.5/8.13.5/Debian-3) with ESMTP id jAMKmpX2003749 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 22 Nov 2005 12:48:51 -0800 Message-ID: <43838433.3080404@lerdorf.com> Date: Tue, 22 Nov 2005 12:48:51 -0800 User-Agent: Thunderbird 1.5 (Macintosh/20051025) MIME-Version: 1.0 To: Matthias Pigulla CC: internals References: <00A2E2156BEE8446A81C8881AE117F192C1C4E@companyweb> In-Reply-To: <00A2E2156BEE8446A81C8881AE117F192C1C4E@companyweb> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: AW: AW: [PHP-DEV] PDM Meeting Notes From: rasmus@lerdorf.com (Rasmus Lerdorf) Matthias Pigulla wrote: > Now that was a quick reply :) > >> Also known as runtime inheritance, or late binding. It's not a new >> thing, we have it today. The discussion was about whether to >> have a way > ... > > That is, one can write > if (...) class A extends X {} else class A extends Y {} > right now? Seriously ;)? > > Every now and then I'm surprised what weird sort of stuff is allowed in > PHP :), but most probably you don't really want to write this sort of > code in the first place? ;) Well, or do a conditional include or an include_once and you end up having to do late binding too. It doesn't have to be as weird as your example, but yes, that works too. >> Just like any other signature in an instance, it tells anything that >> implements the interface that it must have a constructor and that >> constructor must meet the definition in the interface. Useful for >> object factories. In most cases you don't want to force a specific >> constructor in which case you wouldn't specify it in the >> interface, but >> I see no reason why you shouldn't be allowed to specify it >> there if you >> want to. > > The point is that interfaces are nothing you could anything with - that > is, if you have "something" that implements an interface, it has already > been constructed. You never construct instances through an interface > (you would have to choose an implementation, the interface isn't one)... > I just cannot explain it in a better way ;) It's somewhat similar to > that you cannot make static calls on interfaces. I don't see why you can't specify that a class definition must have a constructor. Obviously the constructor is not for the interface itself. -Rasmus