Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26362 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46449 invoked by uid 1010); 5 Nov 2006 18:22:06 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 46434 invoked from network); 5 Nov 2006 18:22:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2006 18:22:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain php.net from 81.169.182.136 cause and error) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from [81.169.182.136] ([81.169.182.136:37127] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F7/0A-10980-ECB2E454 for ; Sun, 05 Nov 2006 13:22:06 -0500 Received: from localhost (strato.aixcept.de [81.169.182.136]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 1D4D5610283; Sun, 5 Nov 2006 19:22:01 +0100 (CET) Date: Sun, 5 Nov 2006 19:21:59 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1295499307.20061105192159@marcus-boerger.de> To: Jeff Moore Cc: Marcus Boerger , php internals LIST , Christian Schneider In-Reply-To: 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 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Why 5.2 should not be delayed for E_DEPRECATED From: helly@php.net (Marcus Boerger) Hello Jeff, Sunday, November 5, 2006, 7:09:26 PM, you wrote: > 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. Yes, both above are correct for Liskov and Lambda Calculus however it is the opposite of what most people expect. Thus we decided against it last year. So in PHP the typehint has to be as in the root class. Best regards, Marcus