Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25142 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26045 invoked by uid 1010); 2 Aug 2006 17:52:46 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 26030 invoked from network); 2 Aug 2006 17:52:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Aug 2006 17:52:46 -0000 X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from ([67.139.134.202:4703] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 08/4A-45114-C66E0D44 for ; Wed, 02 Aug 2006 13:52:44 -0400 Received: (qmail 66843 invoked by uid 98); 2 Aug 2006 17:50:29 -0000 Received: from 127.0.0.1 by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-1.25 ( Clear:RC:1(127.0.0.1):. Processed in 0.235507 secs); 02 Aug 2006 17:50:29 -0000 X-Qmail-Scanner-Mail-From: ceo@l-i-e.com via o2.hostbaby.com X-Qmail-Scanner: 1.25 (Clear:RC:1(127.0.0.1):. Processed in 0.235507 secs) Received: from unknown (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 2 Aug 2006 17:50:28 -0000 Received: from 67.108.68.40 (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Wed, 2 Aug 2006 12:50:28 -0500 (CDT) Message-ID: <11368.67.108.68.40.1154541028.squirrel@www.l-i-e.com> In-Reply-To: <4858f9d90608020200pae76093v86f53f1627e32ba5@mail.gmail.com> References: <18810497049.20060801234124@marcus-boerger.de> <44CFDB2B.1010907@cschneid.com> <4858f9d90608020200pae76093v86f53f1627e32ba5@mail.gmail.com> Date: Wed, 2 Aug 2006 12:50:28 -0500 (CDT) To: "Stefan Walk" Cc: internals@lists.php.net Reply-To: ceo@l-i-e.com User-Agent: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] RfC: rethink OO inheritance strictness From: ceo@l-i-e.com ("Richard Lynch") On Wed, August 2, 2006 4:00 am, Stefan Walk wrote: > For the people who have said "I can not understand why this is a bad > thing": > > http://en.wikipedia.org/wiki/Liskov_substitution_principle Unless I'm mis-reading pre/post condition strictures... Given PHP's cheerfully acceptance of additional arguments to non-existent parameters: NOT KOSHER: class a {function f(){}} class b extends a {function f($a){}} $a = new a; $b = new b; $b->f(); Here, the instance $b of b, a subclass of a, cannot have ->f() called with 0 args without issuing a E_WARNING. So it violates the substitutability of the subclass. This, however, seems KOSHER to me: class a {function f($a){}} class b extends a {function f(){}} $a = new a; $b = new b; $b->f(); So, strictly-speaking, the reference only requires that subclasses have "more general" parameters than the superclasses. All of this seems moot, however, unless we have, or plan to have, software to prove the correctness of PHP scripts. Writing such software, to demonstrate that a PHP script is "Provably Correct" with dynamic typing, seems to me like it would be an NP-incomplete problem, and a non-starter from the get-go... It's been a long time since I've done any "Provably Correct" research, but I don't think that the state of the art has changed that much in this regard -- A few thousand software developers I know would have been blogging for months if this had changed. -- Like Music? http://l-i-e.com/artists.htm