7 ms·
What is the point of Go? What niche does it fill? Is it easy to start working with Go and integrate existing C libraries with it?
by sgt 16y ago
What is the point of Go? What niche does it fill? Is it easy to start working with Go and integrate existing C libraries with it?
- enneff 16y agoWe initially called Go a "systems language," because we wanted to use it to build systems software. What we mean by that is high-performance networked programs that run on multicore machines. The kind of server stuff people traditionally use C or C++ for. Since Go's release last November, we've seen interest in Go from a lot of different places. There was the high-performance computing crowd that we were targeting, but beyond that we saw a lot of users of interpreted languages who craved more speed with the same ease-of-use. We're yet to see which major niche Go fills, if any. There's a growing community of people from different backgrounds using it, and they seem to enjoy it. I personally think it's a lovely language to write all kinds of code in. I recently rewrote our continuous build client in Go, and I found it a cinch to write it in clear, reliable, maintainable way. It's definitely worth checking Go out because, even though it ticks a lot of the same boxes as existing languages, it's quite different from anything else out there in many subtle ways. Certainly for writing server daemons it totally kicks ass. It's easy to get started. The standard library is featureful (http://golang.org/pkg/ http://golang.org/pkg/), and there's a lot of good documentation (http://golang.org/doc/docs.html http://golang.org/doc/docs.html). As for integrating with existing code, Go comes with a tool called cgo (http://golang.org/cmd/cgo/ http://golang.org/cmd/cgo/) which allows you to write Go code that links with C code. It's pretty easy to use, and there are many third party libraries (http://godashboard.appspot.com/project http://godashboard.appspot.com/project) that use it. There's also Go support for SWIG for linking against C++ code.
- mahmud 16y agoEverything that Go has is already in Java. In fact, Go looks like Java with an ActionScript 3.0 syntax. Is there anything going on for it that Java doesn't have, or do better? [Edit: By the way, I keep hearing Go is an excellent language for writing daemons. Why is that? when it doesn't even have anything resembling exception handling, much less a condition system? This is the Go spec: http://golang.org/doc/go_spec.html http://golang.org/doc/go_spec.html ]
- enneff 16y ago> Everything that Go has is already in Java. If you think that, then you need to take a closer look at Go, or Java, or both. In short: Go compiles to native code (no VM), it has a totally different type system (no classes, not everything is an 'object' like in Java), it permits fine control over memory layout and allocation, it has powerful concurrency primitives (goroutines and channels), and more. Do yourself a favour and look beyond the syntax. It really is very different to Java (or Actionscript?! that's one of the more bizarre comparisons I've heard).
- mahmud 16y agoJava compiles to native code too, when and where it matters. I have looked at Go, as much as the spec would permit me, and what I found was a safe C (or a faster, native Pike) with better concurrency primitives and a dash of higher-order functional goodness. With respect to the finer control over memory allocation; anything one couldn't have done with pools in a GC'ed language? I would love to see how Go handles intricate manual memory layout specification under heavy load, and how sufficiently smart the compiler/runtime is as it tries to guess the best GC strategy :-) I wish you all the best.
- kaib 16y ago> With respect to the finer control over memory allocation I think you are understanding it wrong. Go lets you control memory layout, think deciding how things are laid out in a struct. In Java you get indirection and pointers instead. System programming refers mainly to this ability of layout out your data in memory. This makes a world of difference when you are doing high performance code and can control cache locality. Edit, found the link: http://marc.info/?l=git&m=124111702609723 http://marc.info/?l=git&m=124111702609723
- jbooth 16y agoNot really. You can use JNI but it's awkward, discouraged, and every JNI call has overhead -- so much overhead that in the Hadoop project, for example, it was faster to implement their own CRC32 than to use the built in one calling zlib.
- deleted 16y ago[deleted]