On 09/11/2017 06:46 PM, Eric Rahm wrote:
Thanks everyone!

This got a bit derailed but it's clear that a unified style for binary operators is desired.

I received several emails off-list in support of my original proposal, a few people reiterated their preference for operators on the newline and we rehashed that conversation. Overall given the back and forth it seems like we're leaning towards going with unifying the style for splitting binary operators by leaving them on the original line.

At this point I'll leave it to Ehsan, the code-style module owner, to make the final decision.

Apologies for the late response, I was out most of the last week sick.

I think given the practicalities of enforcing the style that we want using clang-format and the strong preference that people seem to have for logical && and || operators being at the end of lines, we should unify our coding style to leave all binary operators on the original line when breaking lines. I've edited the Coding Style accordingly.

Cheers,
Ehsan


-e

On Wed, Sep 6, 2017 at 12:30 PM, Eric Rahm <er...@mozilla.com <mailto:er...@mozilla.com>> wrote:

    Hi folks-

    */Note: Previously we've discussed the placement of logical
    operators && and ||; a decision was made and I do not wish to
    re-litigate that here/*.

    Currently we have a somewhat convoluted set of rules about where
    to place boolean operators when breaking long lines [1].
    Essentially we say that logical operators such as `&&` stay at the
    end, but boolean opertators such as `>` move to the new line. It's
    possible I'm misreading that (others certainly have [2]).

    This is incompatible with tools like clang-format [3] which
    support either leaving the operator at the end of the line or
    moving it to the new line, but not a half and half approach. It is
    very unlikely we could convince them to upstream such a change
    given we are the only organization that has requested it.

    I would like to propose that we adjust our style guide to remove
    the distinction between logical operators and boolean operators
    for the purpose of line breaking and use a unified style.

    *Examples*

    Current rules:

    if ((aArgument == 100) &&
    (anotherReallyLongArgument
         > 2000)) {

    Proposed change if we unify the rules, favoring the logical
    operator placement:

    if ((aArgument == 100) &&
    (anotherReallyLongArgument >
    2000)) {

    I want to emphasize this is a *pragmatic* change, our style guide
    is out of the norm, and the ability of our developers being able
    to use tools like clang-format is a big win.

    Please let me know what you think.

    -e

    [1]
    
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Operators
    
<https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Operators>
    [2] https://bugzilla.mozilla.org/show_bug.cgi?id=1396515
    <https://bugzilla.mozilla.org/show_bug.cgi?id=1396515>
    [3] https://bugzilla.mozilla.org/show_bug.cgi?id=1338105#c16
    <https://bugzilla.mozilla.org/show_bug.cgi?id=1338105#c16>



_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to