Linked by Thom Holwerda on Wed 11th Nov 2009 14:21 UTC
Google Google has invented a new programming language designed to reduce the complexity of coding without compromising the performance of applications. Called Go, the language has been tested internally at Google but is still at an experimental stage, so the company is releasing it as open-source code in the hope that it will get help with its future development.
Permalink for comment 394138
To read all comments associated with this story, please click here.
RE: Dirty?
by frytvm on Wed 11th Nov 2009 22:45 UTC in reply to "Dirty?"
frytvm
Member since:
2009-11-11


Functions can return more than one value (which is cool) like this:
"func foo(i int) (a, b int) {}

A function that returns only one value looks like this:
func bar(i int) int {}

So, I ask, why do we need parentheses when returning more values? Why can't we just write this:
func foo(i int) a, b int {}

"
I'm not sure if there are any technical reasons, but IMHO the parentheses make it more obvious that it's all part of the return type.


Oh, and by the way, the Go does not seem to be object-oriented (I am not sure.) and does not support exceptions...

Go is fairly object-oriented, although a little differently from c++/java (no type hierarchy). Still, it has methods, interfaces, and the like.

As far as exceptions, the FAQ http://golang.org/doc/go_lang_faq.html
suggests that the authors are leaving it as an "open issue" for now, so they might still enter in some form, I guess.

While the lack of exceptions and generics/templates (also an "open issue") make me a little worried, Go still seems like a nice improvement over C for most programs. I'm surprised they didn't make a bigger deal of Go's support for proper closures (at least according to the spec) and anonymous functions, though - making C++ functors is quite painful.

Reply Parent Score: 1