Re: [RFC] skipping optional parameters
| From: | Pierrick Charron | Date: | Wed, 18 Apr 2012 18:05:39 +0000 |
| Subject: | Re: [RFC] skipping optional parameters | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-60193@lists.php.net to get a copy of this message | ||
I like the idea. In fact I started to implement it some time ago, but your
patch is really cleaner than mine :)
Otherwise I would prefer to insert the default keyword to make the code
more readable. It might be hard to count when you have something like
function(,,,,true);
P.
On 17 April 2012 18:54, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
> Hi!
>
> 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:
>
> https://wiki.php.net/rfc/skipparams
>
> Basically, it allows you to do this:
>
> create_query("deleted=0", "name",,, /*report_errors*/ true);
>
> 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.
>
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>