Re: Revisit trailing commas in function call parameters?
| From: | Yasuo Ohgaki | Date: | Thu, 18 Jun 2015 06:25:12 +0000 |
| Subject: | Re: Revisit trailing commas in function call parameters? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86743@lists.php.net to get a copy of this message | ||
Hi Christian,
On Wed, Jun 17, 2015 at 9:05 PM, Christian Schneider <cschneid@cschneid.com>
wrote:
> Hi there,
> now that syntax for variadic functions was added I quickly wanted to ask
> whether allowing trailing commas for function calls could be reconsidered.
>
> It is a very small change to the language allowing something like
> my_variadic_function(
> "foo",
> "bar",
> "qux",
> );
> which makes adding/removing additional parameters a little easier: No
> comma has to be added/removed from the last line.
>
> Previously this was considered unnecessary but maybe things changed enough
> to reconsider it? It doesn't involve any BC break and I attached the very
> simple patch needed in the master branch.
>
> If people still consider it more harm- than useful then please don't flame
> me and I'll shut up again :-)
>
PHP allows
array(
1,
2,
3,
);
therefore
my_variadic_function(
"foo",
"bar",
"qux",
);
is consistent behavior to me.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net