Re: [RFC][DISCUSSION] Revisit trailing commas in function arguments
| From: | Ryan Pallas | Date: | Thu, 15 Oct 2015 19:51:25 +0000 |
| Subject: | Re: [RFC][DISCUSSION] Revisit trailing commas in function arguments | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88837@lists.php.net to get a copy of this message | ||
On Thu, Oct 15, 2015 at 1:46 PM, Sara Golemon <pollita@php.net> wrote:
> On Thu, Oct 15, 2015 at 12:16 PM, Ryan Pallas <derokorian@gmail.com>
> wrote:
> > But its an entirely stylistic choice to use trailing commas for cleaner
> > diffs. You could also use leading commas as well. If you made that a
> coding
> > standard for the organization, you would not have needed to implement
> > trailing am I right?
> >
> > Wouldn't this give the same benefit as trailing commas when it comes to
> > adding removing arguments - a single line diff?
> >
> IMO, that would solve the one small problem in exchange for a new
> small problem. That of the cognitive overhead of parsing leading
> commas where standard practice calls for trailing commas.
>
> And before you counter than the final optional comma also comes with
> overhead, let me point out that the array consistency argument. We
> have trailing commas there already, so no new mental overhead.
>
> Wasn't planning on countering, just trying to show that Hack made a
conscious choice to go this way. I personally don't see a benefit, as its
not hard to read a diff that has a new comma on a previous line following
by a new var/value on the next - but if people do then by all means add it
in :)
I do h ave one question I just thought of though... how does the allowance
of trailing comma work with the splat operator (...)? I'm assuming a
function call/definition may only have one or the other, is that correct?