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

php.internals

Sammy Kaye Powers

9 years ago
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

Net Mo

9 years ago
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>:

Nikita Popov

9 years ago
On Fri, Jan 27, 2017 at 5:05 PM, Sammy Kaye Powers <me@sammyk.me> wrote:
> 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

Christoph Becker

9 years ago
On 27.01.2017 at 17:05, Sammy Kaye Powers wrote:
> 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

Yasuo Ohgaki

9 years ago
On Sat, Jan 28, 2017 at 1:05 AM, Sammy Kaye Powers <me@sammyk.me> wrote:
> 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

Guy Marriott

9 years ago
On Mon, Jan 30, 2017 at 4:17 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> > > 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

Christian Schneider

9 years ago
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

Sammy Kaye Powers

9 years ago
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