views:

1045

answers:

6

Not so long ago Google came out with this new programming language, which was said to be fast as C and intuitive and simple as python. I will not judge this assertions, but instead ask you:

What do you think are Go's advantages and disadvantages?
Can you tell us about a real use you have given to this programming language?

Thanks! Manuel

+3  A: 

Go is built out of asynchronous tasks - goroutines - with message passing between them. This is extremely scalable - this can be mapped to SMT/SMP and clusters (one can imagine a bunch of work-stealing threads), and is a good fit for the scaling sideways direction that silicon has been going in.

So the thing that bothers me is state tracking outside goroutines.

If there were no global variables except language-defined basic concurrent containers, and these were decorated explicitly in the code e.g. 'global' being a prefix to such variables rather as 'volatile' is in C, then it would be the procedural Erlang I think the world needs.

It would be fun to imagine what these concurrent containers would look like, and how it could be backended by redis/GFS2/rdbms as a runtime option, not a code-time option.

Stob says it better: http://www.theregister.co.uk/2009/12/10/verity_stob/page3.html (read the whole article, it's very good)

Will
+6  A: 

I've put my current experiences in my blog at http://mue.tideland.biz/tag/golang. As far as I can see right now Go is a very productive combination of well known features of other languages. It compiles extreme fast, just try a time make for the packages, you'll be astonished. It is statically typed but you can code almost like in a dynamically type language. So the code is small and powerful. And as Will already said it provides a kind of concurrency support almost like Erlang/OTP. Working with goroutines and channels is simple, and together with the new package netchan channels also can be used over the net.

Beside the language Go the libs are also important. Here Go comes already - the language has been announced in November and is still beta - with a large set mainly focussed on network, e.g. http or websocket daemons, template engine, encryption, encoding etc.

Mue
great blog, great blog
Will
+16  A: 

Advantages:

  • Go compiles very quickly.
  • Go supports concurrency at the language level.
  • Functions are first class objects in Go.
  • Go has garbage collection.
  • Strings and maps are built into the language.

Disadvantages:

  • Go is still an experimental language subject to change. (I suppose this could be an advantage depending on how you look at it. For most it's probably a disadvantage.)
  • Go's not very usable on Windows yet.
  • The packages distributed with Go are pretty useful, but there are still some libraries you'll miss. Most notably a UI toolkit.
  • There is no support for generics in Go, although there are many discussions around it.

Other points of note that could be advantages or disadvantages:

  • Go compiles to machine code.
  • Go is very strongly typed.
  • Go is not object oriented in the traditional sense.
Evan Shaw
I liked you answer, but what about the code style, the experience of writing code in Go, and how simple and intuitive it is? Thanks!
Manuel
It's difficult to analyze those types of things in terms of advantages in disadvantages, since it's all subjective. If you have experience with C or similar languages, you should feel right at home pretty quickly. To me, Go feels somewhere in between C and C++. It's not as low level as C, but it doesn't lend itself to OO programming like C++ does and it doesn't have the feature bloat of C++. It has faster compile times and is safer than either one.
Evan Shaw
I don't quite understand the "generics", I thought Go implemented `duck-typing`, ie you call a method taking a `A` with any object as long as it's an instance of a type that implements all the methods of `A`... this seems very `Generic Programming` for me... could you elaborate (and/or correct me) ?
Matthieu M.
@Matthieu M. Look at something like the vector package: http://golang.org/pkg/container/vector/. There's an IntVector, StringVector, and plain Vector. If you're using ints, you want IntVector. If you're using something that's not a string or int, you use Vector. It's not hard to push objects into Vector, but in order to get them out again you have to use type assertions. This is kind of like using void pointers in C for generics. It sort of works, but it's messy. C++ will let you use templates and avoid all that casting.
Evan Shaw
@Chickencha: thanks, I had only thought about it in terms of functions calls, not in terms of classes :)
Matthieu M.
@Matthieu M. Even when you're talking about functions, there are issues. For instance, try to write a function called Max() which takes two arguments, returns the greater one, and works for any type. You can't do it in a single function unless you accept empty interfaces and then do type assertions. Even then you have to write a specific case for each possible type.
Evan Shaw
+11  A: 

Small disadvantage: really bad name GO for a programming language, imagine searching on Google for "Go Object" or "Go Maps" and having gazillion not related pages..

Stewie Griffin
This is why nobody ever uses "Processing" :-)
kubi
wow, this is a huge disadvantage! really!
Manuel
You should try: http://go-lang.cat-v.org/go-search
uriel
+3  A: 

Go is a pragmatic evolution of C to get some of the advantages of the new languages without losing in speed and leanness.

Part of its inheritance stems from Pascal and brings one of the features that Delphi users have always loved in their compilation environment: incredible compile speeds.

Go does not innovate C in the way tat C++ did, but in a Pythonish way.The most notable influence is duck typing (see Python dictionary). This recognizes that some strongly typed languages create as many problems as they solve making you need complex patterns to achieve what a simple interface used as a call contract might solve. By far this is the feature I consider the boldest and most promosing move. I see, not just a simplification in engineering, but also a simplification in reengineering and evolving a code base.

Finally, parallelism built into the language is very promising for the kind of applications that will be targeted first. Lacking UI bindings for any OS, the first use I see for Go is in the creation of servers and application frameworks. In this sense, I see a lot of similarity in purpose with Java and sure Java coders would like something faster in compilation and execution.

mico
+2  A: 

Another advantage of Go is that It includes complex numbers natively. It's very important for scientific computing.

Kamran
That's a recent development - it was not always true.
Jonathan Leffler