I find that multiline conditionals are a good sign I should write a helper function or variable.
if conditionA &&
conditionB &&
conditionC {
bodyOfStatement()
}
this has two major drawbacks in my opinion:
2) there is no visual separation between the "conditions" and the
"body"
1) "conditionA" is visually separated from "conditionB" and
"conditionC"
Do forget other cases:} else if A && B ... {if statement; A && B ... {}And so on. There coud be an entire heuristics paper on how best to format these things. I agree the current gofmt solution is not optimal, however, having a single sub-optimal solution beats multiple "optimal" solutions. With gofmt I know what to expect when reading code. (And even BSD vs GNU go code would look the same with gofmt, oh the horrors!)
On Thursday, May 24, 2012 at 2:17 AM, Reynir Reynisson wrote:
Some people might use a three space wide tabstop.
Yes, that's what I'm suggesting. It keeps the conditional visually grouped.
On Thu, May 24, 2012 at 2:14 PM, Kevin Ballard <kbal...@gmail.com> wrote:Yes, that's what I'm suggesting. It keeps the conditional visually grouped.Please no. I see that for function argument indentation for some languages, and it often ends up with about 10 characters of leeway *on every subseqent line*.
On Thursday, May 24, 2012 at 3:07 PM, Kyle Lemons wrote:On Thu, May 24, 2012 at 2:14 PM, Kevin Ballard <kbal...@gmail.com> wrote:Yes, that's what I'm suggesting. It keeps the conditional visually grouped.Please no. I see that for function argument indentation for some languages, and it often ends up with about 10 characters of leeway *on every subseqent line*.If you've got that many lines for one statement, then I think you have more wrong than just your indentation.