On 18.04.2012 00:54, Stas Malyshev wrote: > 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);
Pretty cool especially since it avoids the problem when refactoring code of knowing whether the use of the default param was intentional or just as a filler to reach a later parameter. I do have two remarks though: - I hope it doesn't mean giving up on named args, because that would look way cleaner. - Would it be possible to allow trailing commas in combination to this? i.e. foo("arg",) would just call foo with "arg" and then the default value for the second arg if there is one, or just nothing. That would make multi-line function calls a bit cleaner, and more similar to arrays. Cheers -- Jordi Boggiano @seldaek - http://nelm.io/jordi -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php