News for hackers. Stuff that matters.
Re:Clear is better than clever [pdf] by networkimprov on Monday May 06, 2019 @01:35PM (#19841769)
What we should be able to write in Go, but can't because the compiler (wrongly) imposes formatting:

   if      a       { v =   1 }
   else if b &&  c { v =  10 }
   else if b && !c { v = 100 }
   else            { v = d }
Re:Clear is better than clever [pdf] by atq2119 on Monday May 06, 2019 @01:45PM (#19841877)
No. This kind of alignment is basically always a mistake and hurts software maintainability in the long run.

The problem is that if one of the conditions changes, for example due to a variable renaming, you likely have to change the alignment on all lines.

Aside from being very tedious even if you're a lone coder, this creates noise in diffs that makes automatic merges fail much more frequently.

Re:Clear is better than clever [pdf] by Cthulhu_ on Tuesday May 07, 2019 @04:20AM (#19847489)
I strongly disagree; creative formatting like this means that as a reader, you have to squint and readjust to this new style to see what is going on.

I mean, this whole thread reads like a holy war about code style - something the Go developers EXPLICITLY want to avoid because discussions about code style are a waste of time.

Everyone reading the above segment of code will have a different opinion on how to format it, while the real question should be "What does this code do". I mean this is highlighted in the preface of the presentation: "When you or I say that a foreign codebase is unreadable, what I think what we really mean is, I don’t understand it."

When I read this code I don't understand it, and it's not because of the formatting per se. Playing with the formatting does not make the purpose of the code clearer.

This whole thread where people argue about how to best format a structure is missing the point of the article completely.

Re:Clear is better than clever [pdf] by GorgeRonde on Tuesday May 07, 2019 @07:14AM (#19848347)
> When I read this code I don't understand it

?