Comment on Google Go: Good For What?parentComments−wtetzner13yI haven't written any Go, but the FAQ (http://golang.org/doc/go_faq.html#principles) says:"There are no forward declarations and no header files; everything is declared exactly once."Is the author just wrong, or has the language changed since the FAQ was last updated?−mseepgood13yHe confuses forward declarations with "declaring the type before the variable name".−nollidge13yI think you mean "declaring the variable name before the type".So C is "int x" where Go is "x int". BASIC is typically more like "DIM x AS INTEGER".−tptacek13yFor the record: as someone who started in the early '90s in C, I hate hate hate the Go declaration syntax. But the designers make a very compelling case for why it's the right syntax: C function pointers are needlessly convoluted.−erichocean13yScala is the same way, and their rational is that it makes it easy (in the parser, I guess) to just omit the type.It is weird at first, but you get used to it, like everything syntactic.−batista13y>For the record: as someone who started in the early '90s in C, I hate hate hate the Go declaration syntax.Why hate something trivial that takes 2 minutes to adjust to and has benefits without any drawbacks whatsoever?−thebigshane13yDoesn't hating something usually imply that one is being irrational about it?I'm sure `tptacek` will get over it :-)
Comments
I haven't written any Go, but the FAQ (http://golang.org/doc/go_faq.html#principles) says:
"There are no forward declarations and no header files; everything is declared exactly once."
Is the author just wrong, or has the language changed since the FAQ was last updated?
He confuses forward declarations with "declaring the type before the variable name".
I think you mean "declaring the variable name before the type".
So C is "int x" where Go is "x int". BASIC is typically more like "DIM x AS INTEGER".
For the record: as someone who started in the early '90s in C, I hate hate hate the Go declaration syntax. But the designers make a very compelling case for why it's the right syntax: C function pointers are needlessly convoluted.
Scala is the same way, and their rational is that it makes it easy (in the parser, I guess) to just omit the type.
It is weird at first, but you get used to it, like everything syntactic.
>For the record: as someone who started in the early '90s in C, I hate hate hate the Go declaration syntax.
Why hate something trivial that takes 2 minutes to adjust to and has benefits without any drawbacks whatsoever?
Doesn't hating something usually imply that one is being irrational about it?
I'm sure `tptacek` will get over it :-)