Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60136 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46573 invoked from network); 17 Apr 2012 23:44:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2012 23:44:48 -0000 Authentication-Results: pb1.pair.com header.from=simon@welsh.co.nz; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=simon@welsh.co.nz; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain welsh.co.nz from 60.234.72.4 cause and error) X-PHP-List-Original-Sender: simon@welsh.co.nz X-Host-Fingerprint: 60.234.72.4 simon.geek.nz Received: from [60.234.72.4] ([60.234.72.4:41461] helo=simon.geek.nz) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/8C-21594-D600E8F4 for ; Tue, 17 Apr 2012 19:44:46 -0400 Received: from [10.0.1.2] (121-73-68-50.cable.telstraclear.net [121.73.68.50]) by simon.geek.nz (Postfix) with ESMTPSA id 6B40F6052C for ; Wed, 18 Apr 2012 11:44:41 +1200 (NZST) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Apple Message framework v1257) In-Reply-To: <4F8DF4B1.2040307@sugarcrm.com> Date: Wed, 18 Apr 2012 11:44:39 +1200 Content-Transfer-Encoding: quoted-printable Message-ID: <0CBF8A52-E369-4F31-9415-43126FA03904@welsh.co.nz> References: <4F8DF4B1.2040307@sugarcrm.com> To: PHP Internals X-Mailer: Apple Mail (2.1257) Subject: Re: [PHP-DEV] [RFC] skipping optional parameters From: simon@welsh.co.nz (Simon J Welsh) On 18/04/2012, at 10:54 AM, Stas Malyshev wrote: > Hi! >=20 > One of the annoying things I've encountered in working with PHP was > dealing with functions having long optional parameter lists, = especially > if you need to change only the last one - you have to copy all the > defaults. Full named params implementation would solve it, probably, = but > before we have that here's an easier solution for part of the problem: >=20 > https://wiki.php.net/rfc/skipparams >=20 > Basically, it allows you to do this: >=20 > create_query("deleted=3D0", "name",,, /*report_errors*/ true); >=20 > Implementation of it is here: > https://github.com/smalyshev/php-src/tree/skip_params > All things described in RFC seem to be working, please tell me if I > forgot anything. If it's accepted I'll also add tests, etc. of course. Hi I like this proposal. One thing pops out at me though. Since func_num_args() won't be able to be used to see if an argument is = set, could a func_isset_arg() be added? So something like: if(func_num_args() > 2) $value =3D func_get_arg(2); would become: if(func_isset_arg(2)) $value =3D func_get_arg(2); --- Simon Welsh