# [RFC][VOTE] Trailing commas in all list syntax

- Thread: https://externals.io/message/97990
- Original archive: https://news-web.php.net/php.internals/97990
- Started by Sammy Kaye Powers on 2017-01-27T16:05:54+00:00
- Messages: 8
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #97990 — Sammy Kaye Powers — 2017-01-27T16:05:54+00:00

URL: https://externals.io/message/97990#97990

Hello my internals friends!

After a 2 week (ahem... 1 year & 3 month - sorry for dropping the
ball) discussion period, the "Trailing commas in all list syntax" RFC
is now open for voting.

See the discussion here:
https://www.mail-archive.com/internals@lists.php.net/msg81366.html

You can vote yay or nay for each possible list syntax individually.

Voting will close 2017-02-10 16:00 (UTC).

Thanks to @WesNetmo for pushing me to bring this to vote. The
community (or at least a sample from twitter) seems to want this
(https://twitter.com/sammyk/status/824298464456691712) so here we go!
:)

Thanks,
Sammy Kaye Powers
sammyk.me

---

## #97992 — netmo.php@gmail.com — 2017-01-27T16:18:42+00:00

URL: https://externals.io/message/97990#97992 · In reply to: #97990

Can I apologize already for the imminent failure? :P I think it's very much
ok on parameters and especially arguments. I don't really care about the
others.

2017-01-27 17:05 GMT+01:00 Sammy Kaye Powers <me@sammyk.me>:

> Hello my internals friends!
>
> After a 2 week (ahem... 1 year & 3 month - sorry for dropping the
> ball) discussion period, the "Trailing commas in all list syntax" RFC
> is now open for voting.
>
> See the discussion here:
> https://www.mail-archive.com/internals@lists.php.net/msg81366.html
>
> You can vote yay or nay for each possible list syntax individually.
>
> Voting will close 2017-02-10 16:00 (UTC).
>
> Thanks to @WesNetmo for pushing me to bring this to vote. The
> community (or at least a sample from twitter) seems to want this
> (https://twitter.com/sammyk/status/824298464456691712) so here we go!
> :)
>
> Thanks,
> Sammy Kaye Powers
> sammyk.me

---

## #97994 — Nikita Popov — 2017-01-27T16:59:58+00:00

URL: https://externals.io/message/97990#97994 · In reply to: #97990

> Hello my internals friends!
>
> After a 2 week (ahem... 1 year & 3 month - sorry for dropping the
> ball) discussion period, the "Trailing commas in all list syntax" RFC
> is now open for voting.
>
> See the discussion here:
> https://www.mail-archive.com/internals@lists.php.net/msg81366.html
>
> You can vote yay or nay for each possible list syntax individually.
>
> Voting will close 2017-02-10 16:00 (UTC).
>
> Thanks to @WesNetmo for pushing me to bring this to vote. The
> community (or at least a sample from twitter) seems to want this
> (https://twitter.com/sammyk/status/824298464456691712) so here we go!
> :)
>

I've voted based on the following rule:
 * Vote yes if the list is enclosed in (), [] or {}.
 * Vote no otherwise.

I can see how it is useful in some cases, but I really don't like the idea
of having a comma followed by a semicolon, as is the case for the class
member declarations...

Nikita

---

## #98030 — Christoph M. Becker — 2017-01-29T23:45:33+00:00

URL: https://externals.io/message/97990#98030 · In reply to: #97990

> After a 2 week (ahem... 1 year & 3 month - sorry for dropping the
> ball) discussion period, the "Trailing commas in all list syntax" RFC
> is now open for voting.
> 
> See the discussion here:
> https://www.mail-archive.com/internals@lists.php.net/msg81366.html
> 
> You can vote yay or nay for each possible list syntax individually.
> 
> Voting will close 2017-02-10 16:00 (UTC).
> 
> Thanks to @WesNetmo for pushing me to bring this to vote. The
> community (or at least a sample from twitter) seems to want this
> (https://twitter.com/sammyk/status/824298464456691712) so here we go!
> :)

Generally, I don't like these trailing commas, but indeed there is some
value for lists that often have to be split across multiple lines.  As
such, my threshold is whether splitting certain lists across multiple
lines is sensible.  In my opinion, the following lists should usually be
one-liners (because having too many items in the list would be a general
design issue):

* function/method *parameters*
* interface implementations on a class
* trait implementations on a class
* class member list (I prefer a distinct statement for each member)
* inheriting variables from the parent scope in anonymous functions

An improvement might be allowing trailing commas in grouped namespaces,
but I haven't enough experience with these to form an opinion.

The only other case where allowing trailing commas would make sense, in
my opinion, are function/methods *arguments* – there is, unfortunately
for me, no explicit voting option.

-- 
Christoph M. Becker

---

## #98033 — Yasuo Ohgaki — 2017-01-30T03:17:35+00:00

URL: https://externals.io/message/97990#98033 · In reply to: #97990

> After a 2 week (ahem... 1 year & 3 month - sorry for dropping the
> ball) discussion period, the "Trailing commas in all list syntax" RFC
> is now open for voting.
>
> See the discussion here:
> https://www.mail-archive.com/internals@lists.php.net/msg81366.html
>
> You can vote yay or nay for each possible list syntax individually.
>
> Voting will close 2017-02-10 16:00 (UTC).
>
> Thanks to @WesNetmo for pushing me to bring this to vote. The
> community (or at least a sample from twitter) seems to want this
> (https://twitter.com/sammyk/status/824298464456691712) so here we go!
> :)
>

I would have voted yes, but I missed the vote.
Unless there is critical reason not to implement it that I don't know of, I
prefer to allow
trailing commas like array universally/consistently.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #98034 — Guy Marriott — 2017-01-30T04:01:03+00:00

URL: https://externals.io/message/97990#98034 · In reply to: #98033

>
>
> I would have voted yes, but I missed the vote.
> Unless there is critical reason not to implement it that I don't know of, I
> prefer to allow
> trailing commas like array universally/consistently.
>
> Regards,
>
> --
> Yasuo Ohgaki
> yohgaki@ohgaki.net


Not that I can vote but AFAICS the vote is still open as per Sammys mail:
https://wiki.php.net/rfc/list-syntax-trailing-commas

---

## #98097 — Christian Schneider — 2017-01-31T21:52:57+00:00

URL: https://externals.io/message/97990#98097 · In reply to: #98033

Am 30.01.2017 um 04:17 schrieb Yasuo Ohgaki <yohgaki@ohgaki.net>:
> Unless there is critical reason not to implement it that I don't know of, I
> prefer to allow trailing commas like array universally/consistently.

I agree that consistency would be preferable here. Syntax subtleties where sometimes you can have trailing commas and sometimes you can't are more confusing than helpful IMHO.

One point where I'm most missing it is function calls because we use some very powerful variadic functions in our core library which can lead to long parameter lists (without being bad design) and therefore profit the most from not having a special case on the last line.

And I really don't expect a proliferation of uglier code by allowing trailing commas while there are cases where it is very useful.

Regards,
- Chris

---

## #98279 — Sammy Kaye Powers — 2017-02-10T16:20:50+00:00

URL: https://externals.io/message/97990#98279 · In reply to: #98097

Voting for the "Trailing commas in list syntax" RFC has closed. Of all
the options, the only one that passed was trailing commas for grouped
namepaces. So that's... cool I guess. :)
#NeverUsedThemBeforeAndProbablyWontButItsCoolThatICanTrailThemThereCommas

A number of you have pointed out that the vote for trailing commas in
"Function/method arguments (declarations & calls)" should have been
separated into two separate votes; one for declarations and one for
calls. Since that vote was almost 50/50 (24 yes/20 no), we could
possibly revisit this one in a new RFC soon.

I've moved the RFC to "Pending Implementation" (for the grouped
namepaces syntax only) and I plan on submitting a PR next week. :)

Thanks to everyone who participated!

Thanks,
Sammy Kaye Powers
sammyk.me
