It’s not quite true that the compiler doesn’t care about white space. The lexer 
is part of the compiler, and it does care about white space. The semicolon 
insertion rule, in particular, pays attention to newlines. So, while the 
compiler doesn’t care about indentation at all, there are some 
brace/indentation styles that it will not accept. One of those is Allman style.

> On Jul 29, 2017, at 1:13 PM, Jan Mercl <0xj...@gmail.com> wrote:
> 
> On Sat, Jul 29, 2017 at 7:36 PM <ecstatic.co...@gmail.com 
> <mailto: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 ?
> 
> Let me pick just one misconception. The compiler does not care about 
> formatting style at all - because it cannot see it! Token sequences have no 
> style as they contain no white space or any other kind of token separators. 
> It's just tokens. All the way down.
> 
> The specification prescribes how the source code text is transformed into the 
> token sequence the compiler only cares about. It's different in details, but 
> conceptually it's just a transformation stage in the sense of what the 
> specification of the, for example, C language prescribes.
> 
> You may dislike the specification, but you can hardly argue it's not well 
> thought out and reasonable as a trade-off between mandatory semicolons (pre 
> Go 1 had them) and almost no need to write them in exchange for adjusting to 
> the implications and/or costs of that comfort.
> 
> If Go changed its specification such that the left brace of a statement block 
> must be on its own line, it'll take me probably just a few minutes to adapt 
> and forget about it completely, because it's such an unimportant detail 
> compared to what I love about Go. Why some others cannot do the same is 
> beyond my comprehension, but that's by definition my fault, admitted.
> 
> -- 
> -j
> 
> 
> -- 
> 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 
> <mailto:golang-nuts+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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.

Reply via email to