I don't get it.  It's not even true K&R style.  
Open brace on function declarations in original K&R books was always on a 
new line.
It is only conditional expressions that have open braces on same line as 
the conditional.
Just check the book,

https://github.com/germanoa/compiladores/blob/master/doc/ebook/The%20C%20Programming%20Language%20-%202nd%20Edition%20-%20Ritchie%20Kernighan.pdf

Best just to call this golang style, or the wrong K&R style. They have 
converted their own style into syntax.

On Saturday, September 21, 2013 at 1:58:03 AM UTC, Michael Daconta wrote:
>
> Hi Go fans,
>
> I frankly was shocked to learn that a program like:
>
> package main;
>
> import "fmt";
>
> func main() 
> {
> fmt.Printf("hello, world!\n");
> }
>
> ... is currently illegal in go with the error:
>
> # command-line-arguments
> .\hello.go:6: syntax error: unexpected semicolon or newline before {
>
> From reading the newsgroups, I see that this is illegal due to the 
> automatic insertion of semi-colons; however, what if I added my own 
> semi-colons into the code as in the above.  From a language perspective the 
> above should be legal Go code.  To me, it seems like a hack for convenience 
> (making semi-colons optional) has forced a K&R style on everyone.
> For me, this is a show-stopper.  Frankly, I am surprised that Google would 
> enforce a coding style (K&R) while saying that "go fmt" frees you from 
> worrying about divergent coding styles.  Sorry, google - you cannot have it 
> both ways.  Unless the Allman-style code above is illegal in the language 
> (which makes no sense from a language semantics point of view) - get the 
> compiler to accept it. Period.
>
> Yes, I know I can write my own translator - but why?  Heck, I can just 
> stick with Java...
>
> C'mon Google, when trying to pitch a new language, you can (and should) do 
> better than this...
>
> - Mike
>

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