Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26359 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38316 invoked by uid 1010); 5 Nov 2006 18:08:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 38301 invoked from network); 5 Nov 2006 18:08:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2006 18:08:32 -0000 Authentication-Results: pb1.pair.com header.from=jeff@procata.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jeff@procata.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain procata.com from 207.58.169.145 cause and error) X-PHP-List-Original-Sender: jeff@procata.com X-Host-Fingerprint: 207.58.169.145 vps.procata.net Linux 2.4/2.6 Received: from [207.58.169.145] ([207.58.169.145:56102] helo=vps.procata.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 71/88-10980-E982E454 for ; Sun, 05 Nov 2006 13:08:31 -0500 Received: from [65.111.206.118] (helo=[65.111.206.118]) by vps.procata.net with esmtp (Exim 4.52) id 1GgmPy-0003fB-Qz; Sun, 05 Nov 2006 13:08:28 -0500 In-Reply-To: <1227362691.20061103191138@marcus-boerger.de> References: <7.0.1.0.2.20061024085428.053f9cf8@zend.com> <7f3ed2c30610240757v28702861r8d5f22f7e3047e60@mail.gmail.com> <7.0.1.0.2.20061024170856.0583dd20@zend.com> <1838975922.20061024205524@marcus-boerger.de> <71B5B01C-EDC5-46B0-8747-0706B2C7DF1F@prohost.org> <454B60E8.8010305@cschneid.com> <1227362691.20061103191138@marcus-boerger.de> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-ID: Content-Transfer-Encoding: 7bit Cc: php internals LIST , Christian Schneider Date: Sun, 5 Nov 2006 13:09:26 -0500 To: Marcus Boerger X-Mailer: Apple Mail (2.624) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.procata.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - procata.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] Why 5.2 should not be delayed for E_DEPRECATED From: jeff@procata.com (Jeff Moore) On Nov 3, 2006, at 1:11 PM, Marcus Boerger wrote: > Liskov applies to static methods as soon as calls via objects are > common > which is true for PHP. Actually in PHP static methods are inherited as > any > other method (also true for a lot of other languages). Now given Liskov > rules you can as well add default parameter values as add new > parameters > with default values and even change type hints (when respecting the > rules > correctly). With C++ the first language has proven that changing > default > parameter values is a bad idea. There however mainly because they are > bound > at compile time based on the compile time types, which results in > default > values that are mostly not what you would expect. In PHP it might work > as > expected but then all programmers that come from langiages like C++ get > confused. Also it would disallow a few optimizer things later (going > the C++ > way of compile time function invocatoin binding). The same holds for > new > additional parameters. In most languages that is no option because it > would > effectively be a different function. In PHP it would eventually work > but add > more confusion that it would help. The last point, changing type hints > in > derived class' methods, was discussed at PDM and declined. The main > reason > for that decision were that all languages we knew of do not support it > and > that most people even do not understand the rules which are quite the > opposite of what most people think. Hi Marcus, Enlightening explanation in a long and confusing thread. To restate the last point for clarification, if the PHP's rules were following Liskov's rules, this php -d"error_reporting=8191" -r 'class Foo {} class FooBar extends Foo {} class T {function f(FooBar $x){}} class S extends T {function f(Foo $x){}}' and possibly php -d"error_reporting=8191" -r 'class T {function f(StdClass $x){}} class S extends T {function f($x){}}' would not be E_STRICT violations as they currently are. In both examples the subclass weakens the parent classes' preconditions (type hints). So PHP's E_STRICT rules are (intentionally) 'stricter' than Liskov's rules. Best Regards, Jeff