question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Relax comma rules to allow optional extra end comma

See original GitHub issue

[@FroMage] I’d like us to relax grammar rules concerning end commas and allow optional trailing commas:

class Foo<A,
                   B,
                   C,
       >(A a,
           B b,
           C c,
         ){
 value seq = {
  a,
  b,
  c,
 };
 Foo<
  Integer,
  String,
  Character,
 >(
  1,
  "a",
  `b`,
 );
} 

This is a particularly terrible example, but allowing extra trailing commas is generally useful, so why not just allow it everywhere commas can be used?

[Migrated from ceylon/ceylon-spec#381]

Issue Analytics

  • State:open
  • Created 11 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
xkr47commented, Sep 10, 2018

I like it for diff’s sake when you keep appending stuff (to lists or hierarchial data structures) as things evolve. Less changed lines. Also when reordering items it helps when you don’t have to keep shuffling the commas.

Priority-wise not very high for my part though 😃

1reaction
CeylonMigrationBotcommented, Sep 9, 2018

[@chochos] I don’t know about everywhere but certainly for list-oriented stuff it is indeed useful:

value seq = {
    one,
    two,
    three,
}; //and you can add or remove items later without having to touch the existing ones
", ".join(one, two, three,); //same here
largest(a,b,); //this should be an error because largest only expects 2 params, it's not sequenced
Read more comments on GitHub >

github_iconTop Results From Across the Web

English Comma Rules - Commatizer
A listing comma separates items in a list of three or more words, phrases or clauses. The last item is usually marked with...
Read more >
Commas (Eight Basic Uses) - Okanagan College
USE A COMMA TO SEPARATE INDEPENDENT CLAUSES. Rule: Use a comma before a coordinating conjunction (and, but, yet, so, or nor, for) when...
Read more >
Commas (Eight Basic Uses): IU East
1. Use a comma to separate independent clauses ... Rule: Use a comma before a coordinating conjunction (and, but, yet, so, or nor,...
Read more >
Rules for Using Commas | Grammarly
However, the final comma—the one that comes before the and—is optional. This comma is called the serial comma or the Oxford comma.
Read more >
The Optional Comma | The Proofreading Pulse
A classic optional comma shows up with conjunctive structures. The rule is that when you have two complete sentences joined by a conjunction, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found