Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60197 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12434 invoked from network); 18 Apr 2012 20:15:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2012 20:15:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.21 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.21 smtp1.ist.utl.pt Linux 2.6 Received: from [193.136.128.21] ([193.136.128.21:52432] helo=smtp1.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A4/61-03623-1D02F8F4 for ; Wed, 18 Apr 2012 16:15:14 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 4F50370003CB; Wed, 18 Apr 2012 21:15:10 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp1.ist.utl.pt ([127.0.0.1]) by localhost (smtp1.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id 78DS9eOv0nQP; Wed, 18 Apr 2012 21:15:10 +0100 (WEST) Received: from nebm.ist.utl.pt (unknown [IPv6:2001:690:2100:4::58:1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 0D99D7000458; Wed, 18 Apr 2012 21:15:09 +0100 (WEST) Received: from localhost ([127.0.0.1] helo=damnation.mshome.net) by nebm.ist.utl.pt with esmtp (Exim 4.72) (envelope-from ) id 1SKbHR-00057r-PL; Wed, 18 Apr 2012 21:15:09 +0100 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes In-Reply-To: <4F8DF4B1.2040307@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: <4F8DF4B1.2040307@sugarcrm.com> To: "PHP Internals" , "Stas Malyshev" MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable Date: Wed, 18 Apr 2012 22:15:16 +0200 Message-ID: User-Agent: Opera Mail/11.62 (Win32) Subject: Re: [PHP-DEV] [RFC] skipping optional parameters From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Wed, 18 Apr 2012 00:54:41 +0200, Stas Malyshev wrote: > [snip] > https://wiki.php.net/rfc/skipparams > > [snip] =C2=ABFor internal functions, parameter parser will ignore the NULLs, th= us leaving the defaults supplied by the caller intact. Again, skipping non-optional parameter is an error.=C2=BB This would cause a lot of problems. Basically, all the functions that re= ly on ZEND_NUM_ARGS() will have to be changed. You can't tell if a paramete= r was passed or not by relying on it. For instance, if you have ZEND_NUM_ARGS() yielding x, but skipped arg x = - y, now the variable for the argument x - y won't be touched but the function will think the argument was supplied. Segfaults and unpredictab= le behavior due to uninitialized values and other logic errors will follow.= Of course, this because internal functions don't have "default values", = at least not the same way user-land functions do. This seems a lot of trouble for a feature that, in my opinion, even if i= t could be implemented without problems, won't be useful enough to overcom= e the strong presumption that exists against new syntax changes. Maybe I'm= lucky, but the problem you're trying to solve is at most an occasional minor nuisance for me. Plus, this solution encourages bad behavior. If w= e want to properly support long argument lists (and I'm not we do), we hav= e to have named parameters. -- = Gustavo Lopes