Re:Why Go gets criticized so much
by kazinator on Friday April 08, 2016 @12:10PM
(#11455730)
RATIONALE: why the two styles? Why
if (simple_condition) {
code;
}
but:
if ((complicated ||
multi_line)
&& condition)
{
code;
}
?
Simple: it's because in both cases, the "code" follows a previous line from whose first non-whitespace character it indents by the indentation level:
if (...
[INDENT]code
{
[INDENT]code
This is just wacky:
while (blah
blah
blah) {
code
}
"code" isn't "indenting off of" anything. It is not related to the indentation of "blah" in any way, but appears to be "deindenting" from it!
So, rather than dogmatically doing one thing or another, it's better to consider all the alternatives, their relative advantages and disadvantages, and integrate them into an elegant whole.
Simple: it's because in both cases, the "code" follows a previous line from whose first non-whitespace character it indents by the indentation level:
This is just wacky: "code" isn't "indenting off of" anything. It is not related to the indentation of "blah" in any way, but appears to be "deindenting" from it!So, rather than dogmatically doing one thing or another, it's better to consider all the alternatives, their relative advantages and disadvantages, and integrate them into an elegant whole.