Re: Should &&/|| really be at the end of lines?

2017-02-23 Thread Emilio Cobos Álvarez
On Wed, Feb 22, 2017 at 10:27:33AM -0500, Benjamin Smedberg wrote: > On Thu, Feb 16, 2017 at 4:47 PM, wrote: > > > Question of the day: > > When breaking overlong expressions, should &&/|| go at the end or the > > beginning of the line? > > > > TL;DR: Coding style says

Re: Should &&/|| really be at the end of lines?

2017-02-20 Thread Bobby Holley
On Sun, Feb 19, 2017 at 8:07 PM, Martin Thomson wrote: > On Mon, Feb 20, 2017 at 3:18 AM, smaug wrote: > > I don't care too much about &&/|| coding style, though the current style > > does feel easier to > > read, per the reasoning dmajor gave. > > I suspect

Re: Should &&/|| really be at the end of lines?

2017-02-19 Thread Martin Thomson
On Mon, Feb 20, 2017 at 3:18 AM, smaug wrote: > I don't care too much about &&/|| coding style, though the current style > does feel easier to > read, per the reasoning dmajor gave. I suspect that a lot of people think this way. While it's tempting to suggest that arguments

Re: Should &&/|| really be at the end of lines?

2017-02-19 Thread smaug
On 02/18/2017 07:08 PM, Eric Rescorla wrote: I'd also note that if we're not going to use "this is what we have done historically" as a guide, then it seems like much bigger changes are on the table and we would probably be better off adopting some other well-defined coding standard wholesale

Re: Should &&/|| really be at the end of lines?

2017-02-18 Thread Kyle Lahnakoski
On 2017-02-16 18:21, Jean-Yves Avenard wrote: > > > On 17/02/17 00:17, Jeff Gilbert wrote: >> If there are so many parens that we require an editor to disambiguate >> them, it's too dense. Add whitespace or decompose the expression until >> readable. >> > I'd love to know how adding any

Re: Should &&/|| really be at the end of lines?

2017-02-18 Thread Michael Froman
> On Feb 17, 2017, at 6:24 PM, ISHIKAWA,chiaki wrote: > > Point 2: > I prefer all the operators including "&&" and "||" > at the beginning since such a format makes the tree-like structure of > multi-line easier to understand and edit, too. > Adding a condition or

Re: Should &&/|| really be at the end of lines?

2017-02-18 Thread Jean-Yves Avenard
On 17/02/17 23:18, gsquel...@mozilla.com wrote: Hi again Nick, Someone made me realize that I didn't fully read your message, sorry for that. I now see that as well as &&/||, you have grepped for other operators, and shown that the overwhelming usage is to put all of them at the end of

Re: Should &&/|| really be at the end of lines?

2017-02-17 Thread gsquelart
On Saturday, February 18, 2017 at 10:50:24 AM UTC+11, Boris Zbarsky wrote: > On 2/17/17 5:44 PM, gsqu...@mozilla.com wrote: > > - People who stick with the official parser will only ever see that > > (pushing to mozreview will reformat everything to the official style). > > Not all reviews go

Re: Should &&/|| really be at the end of lines?

2017-02-17 Thread ISHIKAWA,chiaki
On 2017/02/18 7:28, Bobby Holley wrote: On Fri, Feb 17, 2017 at 2:18 PM, wrote: Hi again Nick, Someone made me realize that I didn't fully read your message, sorry for that. I now see that as well as &&/||, you have grepped for other operators, and shown that the

Re: Should &&/|| really be at the end of lines?

2017-02-17 Thread Boris Zbarsky
On 2/17/17 5:44 PM, gsquel...@mozilla.com wrote: - People who stick with the official parser will only ever see that (pushing to mozreview will reformat everything to the official style). Not all reviews go through mozreview. -Boris ___

Re: Should &&/|| really be at the end of lines?

2017-02-17 Thread Jared Wein
After dealing with bugs that only happen in PGO builds, I would be worried about bugs in the code-formatting-rewriter. The value doesn't seem worth the risk to me. - jared On Fri, Feb 17, 2017 at 5:44 PM, wrote: > On Saturday, February 18, 2017 at 9:29:06 AM UTC+11,

Re: Should &&/|| really be at the end of lines?

2017-02-17 Thread gsquelart
On Saturday, February 18, 2017 at 9:29:06 AM UTC+11, Bobby Holley wrote: > On Fri, Feb 17, 2017 at 2:18 PM, wrote: > > > Hi again Nick, > > > > Someone made me realize that I didn't fully read your message, sorry for > > that. > > > > I now see that as well as &&/||, you

Re: Should &&/|| really be at the end of lines?

2017-02-17 Thread Bobby Holley
On Fri, Feb 17, 2017 at 2:18 PM, wrote: > Hi again Nick, > > Someone made me realize that I didn't fully read your message, sorry for > that. > > I now see that as well as &&/||, you have grepped for other operators, and > shown that the overwhelming usage is to put all of

Re: Should &&/|| really be at the end of lines?

2017-02-17 Thread gsquelart
Hi again Nick, Someone made me realize that I didn't fully read your message, sorry for that. I now see that as well as &&/||, you have grepped for other operators, and shown that the overwhelming usage is to put all of them at the end of lines! In light of this, and from what others here have

Re: Should &&/|| really be at the end of lines?

2017-02-17 Thread Eric Rescorla
On Thu, Feb 16, 2017 at 11:39 PM, David Major wrote: > One thing I like about trailing operators is that they tend to match > what you'd find in bullet-point prose. Here's a made-up example: > > You can apply for a refund of your travel insurance policy if: > * You cancel

Re: Should &&/|| really be at the end of lines?

2017-02-17 Thread Nicholas Nethercote
On Fri, Feb 17, 2017 at 5:28 PM, wrote: > Of course grepping agrees with you, since it's been the coding style so > far! ;-) > I was hoping to change that, if most people agreed. > Isn't the current style that && and || go at the end but other operators go at the start?

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread David Major
One thing I like about trailing operators is that they tend to match what you'd find in bullet-point prose. Here's a made-up example: You can apply for a refund of your travel insurance policy if: * You cancel within 7 days of purchase, and * You have not yet begun your journey, and * You have

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread gsquelart
Of course grepping agrees with you, since it's been the coding style so far! ;-) I was hoping to change that, if most people agreed. While it's good to know how many people are for or against it, so that we get a sense of where the majority swings, I'd really like to know *why* people have

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread Nicholas Nethercote
I personally have a strong preference for operators at the end of lines. The codebase seems to agree with me, judging by some rough grepping ('fff' is an alias I have that's roughly equivalent to rgrep): $ fff "&&$" | wc -l 28907 $ fff "^ *&&" | wc -l 3751 $ fff "||$" | wc -l 26429 $ fff

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread Martin Thomson
On Fri, Feb 17, 2017 at 10:39 AM, Robert O'Callahan wrote: >> Using clang-format on the entire tree has the massive value of: > > Also, it's very liberating not having to think about formatting while > writing code, knowing it will be automatically fixed up later. This is >

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread gsquelart
Thank you David. Your opinion about any *future* change to &&/|| style would be appreciated. ;-) About "increased disruption to blame that makes understanding the history of our code harder": I think some tools like http://searchfox.org/ have considerably lessened the impact to blame, because

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread Robert O'Callahan
On Fri, Feb 17, 2017 at 12:25 PM, L. David Baron wrote: > Using clang-format on the entire tree has the massive value of: > > * reviewers not needing to point out whitespace and indentation issues > > * reduced friction for new contributors (being able to use a tool >

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread Jeff Gilbert
I'll not get into why I disagree with your points about format-the-world here. Let's leave that for elsewhere. Here's my take on the example at hand: https://pastebin.mozilla.org/8979527 In this case, I do like the latter two best. (Old-style and simplification) On Thu, Feb 16, 2017 at 3:25 PM,

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread L. David Baron
On Thursday 2017-02-16 15:11 -0800, Jeff Gilbert wrote: > I would not assume that's necessarily going to happen without > contention. Consistency is not a goal in and of itself. Using clang-format on the entire tree has the massive value of: * reviewers not needing to point out whitespace and

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread gsquelart
Jeff, I see you're opinionated against consistency. :-) Or you think there are other more important things? Anyway, I'm not exactly sure what you're advocating. Could you please elaborate? On Friday, February 17, 2017 at 10:11:25 AM UTC+11, Jeff Gilbert wrote: > I would not assume that's

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread Jeff Gilbert
If there are so many parens that we require an editor to disambiguate them, it's too dense. Add whitespace or decompose the expression until readable. On Thu, Feb 16, 2017 at 3:15 PM, Mike Hommey wrote: > On Fri, Feb 17, 2017 at 12:10:32AM +0100, Jean-Yves Avenard wrote: >>

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread Mike Hommey
On Fri, Feb 17, 2017 at 12:10:32AM +0100, Jean-Yves Avenard wrote: > reading this: (turn on courier) > > return ((aCodecMask & VPXDecoder::VP8) > && aMimeType.EqualsLiteral("video/webm; codecs=vp8")) > || ((aCodecMask & VPXDecoder::VP9) > &&

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread Jeff Gilbert
Both are readable with judicious indentation on wrapping. If you must recompose the entire expression in your mind, the code is too terse, and we should consider cleaning it up and making it more readable. &&/|| position will not make or break this. On Thu, Feb 16, 2017 at 3:10 PM, Jean-Yves

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread Jeff Gilbert
I would not assume that's necessarily going to happen without contention. Consistency is not a goal in and of itself. On Thu, Feb 16, 2017 at 3:04 PM, wrote: > There's an ongoing effort to use clang-format to automatically format All The > Codes [1], so I think we should

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread Jean-Yves Avenard
Hi On 16/02/17 23:56, Jeff Gilbert wrote: I don't visually like ||/&& at start of line, but I can't fault the reasoning, so I'm weakly for it. I don't think it's important enough to change existing code though. Disclaimer: I'm now biased about this. I've been writing C and C++ code for now

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread gsquelart
There's an ongoing effort to use clang-format to automatically format All The Codes [1], so I think we should try and make sure we agree (or at least settle*) on a coding style when it's going to be enforced everywhere. ;-) * I'm presenting my own preferences here, but in the end I'm fine with

Re: Should &&/|| really be at the end of lines?

2017-02-16 Thread Jeff Gilbert
I don't visually like ||/&& at start of line, but I can't fault the reasoning, so I'm weakly for it. I don't think it's important enough to change existing code though. On Thu, Feb 16, 2017 at 1:47 PM, wrote: > Question of the day: > When breaking overlong expressions,

Should &&/|| really be at the end of lines?

2017-02-16 Thread gsquelart
Question of the day: When breaking overlong expressions, should &&/|| go at the end or the beginning of the line? TL;DR: Coding style says 'end', I think we should change it to 'beginning' for better clarity, and consistency with other operators. Our coding style reads: "Break long conditions