_______________________________________________
dev-gaia mailing list
dev-...@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-gaia
The high level rule for coding style should always be how does this syntax helps to make the code more readable?
In this case, I think the parens add clutter to the code with no added benefits.
On Wed, Sep 16, 2015 at 11:33 AM, Guillaume Marty <gma...@mozilla.com> wrote:The high level rule for coding style should always be how does this syntax helps to make the code more readable?
In this case, I think the parens add clutter to the code with no added benefits.I slightly disagree with this. The point of making the parens "always" is to reduce friction when needing to refactor the signature of a function. Whether moving from one argument to many, or many to one, you have to always change whether there would be parens or not if you didn't follow the "always" convention:
```// Original:array.map(value => log(value));// Wanting to log index also requires adding parens:array.map((value, index) => log(value, index));// Whereas having parens always would only need argument changes:array.map((value) => log(value));```
Yes, I understand that the changing of parens and enforcement of style can be controlled through linters, and adding and removing of parens is trivial, but it's about simple conventions that reduce friction. In that case, I would argue that parens "always" is the way to go.Eli Perelman