Linked by Thom Holwerda on Wed 11th Nov 2009 14:21 UTC
Permalink for comment 394138
To read all comments associated with this story, please click here.
To read all comments associated with this story, please click here.
Features
Linked by Thom Holwerda on 06/13/13 14:35 UTC
Linked by Thom Holwerda on 06/11/13 17:07 UTC
Linked by Thom Holwerda on 06/10/13 23:13 UTC
Linked by Thom Holwerda on 06/08/13 14:57 UTC
Linked by Thom Holwerda on 06/07/13 11:40 UTC
Linked by Thom Holwerda on 06/04/13 12:45 UTC
Linked by nfeske on 05/31/13 10:12 UTC
Linked by Thom Holwerda on 05/29/13 16:59 UTC
Linked by Thom Holwerda on 05/24/13 17:26 UTC
Linked by Thom Holwerda on 05/21/13 21:38 UTC
More Features »
Sponsored Links



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:
So, I ask, why do we need parentheses when returning more values? Why can't we just write this:
"
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.