1. 2
  1.  

  2. 3

    Or, design and use languages where such commas are not needed, or campaign to get the commas removed in array and dict notation. In all the cases given, removing comma introduces no ambiguity.

     [ my,
       small,
       list,
     ]
    

    to

     [ my
       small
       list
     ]
    

    There is also the fact that some coding standards prefer comma in front, eliminating need for dangling commas

     [ my
     , small
     , list
     ]
    
    1. 1

      Comma in front has always been my go-to but it’s definitely head-spinning trying to come up with easily readable formatting for sizeable expressions (“functional” imperative programming) in c-style languages; not only is there the comma issue in function parameters and array constructors, but there’s 3-4 different kinds of nesting at any given time: function-in-function, infix-ish expressions like ternary operators, dot-syntax methods/promises/etc, not to mention the road hazard that is huge type declarations hanging out mid-expression in casts and generics. Sometimes I feel bad for my colleagues that have to maintain categorically unreadable code.

    2. 1

      Or just… don’t design languages where commas are the separator. Use semicolons for everything you’d otherwise use commas for. Then everybody’s aesthetics are satisfied, except that a few more pixels are darkened, which I realize gives the language a measurably less friendly feel, but come on… It saves a lot of arguing. :)

      1. -2

        NO NO NO NO NO NO NO You, sir, are worse than Hitler. A comma is not a terminator, it is a separator. Separators go between things, not after them.

        To address the actual points:

        1) If you have a problem with diff, fix diff.

        2) If you want to transform code by rote without doing any manual work, then do so by transforming the AST. Since only the JavaScript community could possibly be so badly suffering from Stockholm syndrome in order to enforce dangling commas in what they seem to think constitutes a “lint”, use JSCodeshift from Facebook.

        3) ….

        wait, those two trivial issues are all the justification for something as abhorrent as trailing commas? GG.

        1. 1

          How do you propose to fix diff? You’ll also have to fix patch, btw.