Unless you use leading comma style, trailing commas are very good to have for 
anything that has variable amount of items/keys/arguments. 

This is a classic example I use to show why JSON is a bad idea: 
https://github.com/npm/npm/commit/20439b21e103f6c1e8dcf2938ebaffce394bf23d#diff-6

I believe the same thing applies for javascript functions. If it was a bug in 
javascript, I wish for more such bugs really...


04.07.2014, 20:33, "Oliver Hunt" <oli...@apple.com>:
> On Jul 3, 2014, at 3:52 PM, Dmitry Soshnikov <dmitry.soshni...@gmail.com> 
> wrote:
>>  Hi,
>>
>>  Will it makes sense to standardize a trailing comma for function arguments, 
>> and call parameters?
>>
>>  We have it for Array and Object initialisers, and people like using them 
>> for long lists with prediction of new items adding in the future:
>>
>>  ```
>>  var modes = [
>>    read,
>>    write,
>>  ];
>>
>>  var platforms = {
>>    web,
>>    canvas,
>>  };
>>  ```
>
> I suspect, but brendan could tell us otherwise, that the allowance of 
> trailing commas is a result of a bug in the _early_ _early_ days of JS, which 
> then got matched by the wonders of bug for bug compat, and so became 
> necessary for web compatibility.
>
> Also, i’m not sure that your intended uses is sufficiently compelling to 
> justify non-backwards compatible syntax (i’m not against adding new syntax, i 
> just feel that it needs to have substantial benefits)
>
> Hence, i don’t think this should be extended to other constructs.
>
> —Oliver
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to