Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55531 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45158 invoked from network); 19 Sep 2011 09:32:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2011 09:32:21 -0000 Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 85.139.253.17 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 85.139.253.17 unknown Linux 2.6 Received: from [85.139.253.17] ([85.139.253.17:53430] helo=alfresco) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/2A-14600-22C077E4 for ; Mon, 19 Sep 2011 05:32:19 -0400 Received: from localhost ([127.0.0.1] helo=clk-0081.mshome.net) by alfresco with esmtp (Exim 4.72) (envelope-from ) id 1R5aD1-0002Qd-Q6 for internals@lists.php.net; Mon, 19 Sep 2011 10:32:15 +0100 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes In-Reply-To: <4E7708FA.7080802@sugarcrm.com> Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= References: <4E74E5A0.2030006@sugarcrm.com> <4E76320F.6010904@sugarcrm.com> <4E764137.9080507@sugarcrm.com> <4E7708FA.7080802@sugarcrm.com> To: "internals@lists.php.net" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Date: Mon, 19 Sep 2011 10:32:15 +0100 Message-ID: User-Agent: Opera Mail/11.51 (Win32) Subject: Re: [PHP-DEV] __constructor parameter limitations. From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") Em Mon, 19 Sep 2011 10:18:50 +0100, Stas Malyshev escreveu: > On 9/19/11 2:12 AM, Gustavo Lopes wrote: >> Arbitrary as it may be, it's nevertheless reasonably arbitrated given >> how little useful it is to just ignore arguments and how likely it is >> to a >> mistake. > > It is not little useful and it is not likely to make such mistake > without immediately being notified and corrected. I don't know how you > make these assumptions or what they are based on - could you please > bring some evidence? It would obviously be hard to produce such evidence. Measuring how common a mistake is very difficult without some study to that effect since those mistakes are steeply underrepresented in the public PHP code corpus (i.e. they get fixed). And measuring how common overrides with less arguments are would still require relatively complex code analysis. So, no, I cannot prove the assertions behind my argument, I can only say I believe them to be plausible. >> And I don't buy the func_get_args() argument. Why would anyone use >> func_get_args for anything other than variadic functions?... I certainly >> don't. > > So you say if you personally don't use something in PHP nobody should > use it? > And, BTW, what's wrong with variadic functions (i.e., ones accepting > variable number of arguments)? Such functions are commonplace in PHP. The thing if you introduce func_get_args() to the argument, any discussion about enforcing signatures becomes meaningless. One could argue this should be allowed: class A { function foo() {} } class B extends A { function foo($a) {} } Because for all we know the implementation of A::foo() could have: function foo() { $a = func_get_args()[0]; } -- Gustavo Lopes