3 ms·
> The argument of white space or braces is largely a religious one. True. That said, my main point is that standardizing on how to layout code is very helpful,
by wiremine 11y ago
> The argument of white space or braces is largely a religious one.
True. That said, my main point is that standardizing on how to layout code is very helpful, either through the compile or using a preprocessor (like gofmt) is helpful, and more languages should encourage it out of the box.
- laumars 11y agoQuite a few languages do standardise style though (eg C# https://msdn.microsoft.com/en-us/library/ff926074.aspx https://msdn.microsoft.com/en-us/library/ff926074.aspx). Just as quite a few (possibly most?) companies will have their own coding policies as well. The problem is when individuals decide to go off piste and do their own thing. But then those same individuals could equally be likely to bypass gofmt when writing code (which is very easily done), or to ignore company policy about tab spaces et al when writing Python code. That said, I've learned to love gofmt for the laziness it brings. Text editors that auto-close brackets and such like can often be more of an intrusion than an asset. Where as gofmt only jumps in after the document is saved and the syntax is parsed for errors. So sometimes I find myself just throwing code down knowing that gofmt will tidy it up for me as I go. Which I'd be the first to admit is a pretty bad habit to get into hehehe
- seanmcdirmid 11y agoIDEs typically close braces not to help you type or to enforce format rules, but to provide better feedback during a language aware editing session. Compilers can do amazing things with error recovery for code being edited, but still have problems inferring missing braces.
- laumars 11y agoYou misunderstand me; I wasn't suggesting auto-closing of brackets was a method of enforcing format rules (that would be a dumb statement to make for the very reasons you highlighted). I was just commenting on how non-intrusive gofmt is when compared to the other tools that alter code while your programming.
- seanmcdirmid 11y agoYes, but they are solving different problems so aren't very comparable, even if they both work by modifying code. I just want to clear the air about why we IDE developers go this route.
- laumars 11y agoThe fact that they are both modifying code makes them comparable from an end user experience perspective, which was the comparison I clearly made. I appreciate you wanting to be specific about their intended purpose but, frankly, you're stating the obvious. Anyone who's spent more than 5 minutes inside an IDE (or even basic programming-geared text editor) will already be well versed on the subject. You don't need to be an IDE developer to understand this (and to be honest, what developer hasn't written their own programming environment at some point in their lives anyway? :p ) In any case, I was just making a light-hearted passing comment; hence the "hehehe" at the end of it. It didn't really add anything to my original post and certainly wasn't meant to picked apart in this level of detail.
- seanmcdirmid 11y agoYou'd be surprised how many developers think brace completion or even code competion is trying to help them type. I've been in huge flame wars in the past where users simply misunderstood why a feature was there and what it's benefits were (brace completion...better interactive feedback, code completion...API discovery).