On Sat, Jul 29, 2017 at 10:36 AM, <ecstatic.co...@gmail.com> wrote: > > ... > > But as Gofmt can ALREADY enforces this common coding style, and can be run > at any time, including before committing code on the depots, why should it > be enforced by the COMPILER too ? > > Really, that's the one particular engineer decision I regret. Just one. But > that's a big one. Because sometimes, almost ENTIRE teams prefer the Allman > style. That's not just a personal affair. All that because maybe 2 or 3 > languages designers have decided so, moreover to make it easy to > automatically add the semi-colons. > > And it doesn't even work well, we are now force to put a useless comma after > the last parameter of a function to be allowed to split the arguments on > several lines. Please don't insult me by telling there wasn't any other > possible solution. > > For instance, in Javascript, the semi-colon are also optional, but the > compiler lets you use whatever coding style you want.
I'll note that there is a lot of discussion on the web about problems with semicolons in Javascript. When we were discussing the possibility of a lexical semicolon insertion rule shortly after the Go open source release, Javascript was considered to be an example of how not to do it. Historically speaking, gofmt came before lexical semicolon insertion. The existence of gofmt made it possible to seriously consider lexical semicolon insertion. Implementing it did require, yes, that you must put a comma after a parameter name in order to split a line and, yes, that you must put the '{' on the same line as the function definition or if/for/switch statement, etc. We considered that to be an acceptable drawback to get a simple rule, knowing that gofmt would handle all such issues anyhow. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.