Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56404 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15493 invoked from network); 18 Nov 2011 17:40:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Nov 2011 17:40:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=ralph@ralphschindler.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ralph@ralphschindler.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ralphschindler.com from 209.85.161.170 cause and error) X-PHP-List-Original-Sender: ralph@ralphschindler.com X-Host-Fingerprint: 209.85.161.170 mail-gx0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:45272] helo=mail-gx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EC/D2-06569-77896CE4 for ; Fri, 18 Nov 2011 12:40:07 -0500 Received: by ggnk1 with SMTP id k1so1866402ggn.29 for ; Fri, 18 Nov 2011 09:40:05 -0800 (PST) Received: by 10.100.216.9 with SMTP id o9mr1031687ang.83.1321638005082; Fri, 18 Nov 2011 09:40:05 -0800 (PST) Received: from ralph-mac.local (ip174-73-14-247.no.no.cox.net. [174.73.14.247]) by mx.google.com with ESMTPS id i31sm3808713anm.19.2011.11.18.09.40.03 (version=SSLv3 cipher=OTHER); Fri, 18 Nov 2011 09:40:04 -0800 (PST) Message-ID: <4EC69872.6060300@ralphschindler.com> Date: Fri, 18 Nov 2011 11:40:02 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Pierre Joye CC: internals References: <4EC578C9.4000408@ralphschindler.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Changes to constructor signature checks From: ralph@ralphschindler.com (Ralph Schindler) Hey Pierre, My perspective and expectations are framed by all sorts of existing literature as well as the discussions on this list. It saddens me that you did not address any of the points I've brought up. And, I simply cannot tell what basis you have for your interpretation and opinion. It seems more like you're basing your interpretation on preference alone. The facts are this: 1) What we know and have been told is that PHP's signature checking is governed by Liskov Substitution Principle. There are many references to this in the list. I've made my argument based on the LSP. http://marc.info/?r=1&w=2&q=b&l=php-internals&s=lsp 2) "Abstract Constructors" do not exist in any other language, for all intents and purposes, it's something we've invented: http://www.google.com/search?&q=%22abstract+constructor%22 That's fine, so now the question is, how does this thing we've invented play in with our current implementation of a class based object model and how does it meet developer preexisting expectations? 3) In places that have no formal expectation and understanding in other programming languages, we've OFTEN favored *looseness over strictness* Even you Pierre, once promoted "looseness" http://news.php.net/php.internals/25089 (Pierre) 4) We should meet everyone's existing expectations, Rasmus talks about this: http://news.php.net/php.internals/25090 (Rasmus) and this is the general expectations: http://www.google.com/search?q=constructor+liskov http://stackoverflow.com/questions/5490824/should-constructors-comply-with-the-liskov-substitution-principle > > class A { > function __construct($a, $b) { > } > } > > class B extends A{ > function __construct($a) { > } > } > > > works. > > While the following does not: > > Abstract class A { > abstract function __construct($a, $b); > } > > class B extends A{ > function __construct($a) { > } > } Which makes no sense b/c this does work: abstract class A { abstract public function __construct($one, $two, $three); } class C extends A { public function __construct($one, $two, $three) {} } class D extends C { public function __construct($foo) {} } I assume this is b/c only one ->ce_parent is checked for "definition correctness" or whatever this new feature is we're calling ... but more to the point, do we really want to recurse every parent definition looking for an abstract __construct() and checking the signature at runtime? > does not and it is per definition correct. Abstract defines the > signature and ensures that the signature are 100% the same. Where do you get your foundational basis for this? What rules outside of the LSP are we looking at to make this determination? And, can you honestly say that of the global community of developers, this is the expected outcome? > We had a long discussion about that a couple of months ago. The main > disagreement was about the interpretation of the definition of > abstract. Abstract clearly talks about signature matching, as I (and > quite a lot of other) read it. According to the RFC (https://wiki.php.net/rfc/prototype_checks) a consensus was never reached - and more discussion was needed (which as of the date of the RFC and timestamps in the mailing list, has not happened). -ralph