The language, libraries, and ecosystem are miles ahead of where they were back in 2009.
Why not use C? Because C has no sensible packaging system, is unsafe, requires manual memory management, and offers a degree of control that is unnecessary for most tasks. Why not use Java? Because it is verbose and picky and basically forces you to use an IDE to get anything done, etc etc. If there were nothing wrong with these languages (they're the main ones we use at Google) we wouldn't have developed Go.
Use Go more! You'll see why people love it, and why we created it.
I evaluated Go last week (2013-03), but there is no meaningful Eclipse IDE support. goclipse doesn't work half as well as CDT, and not a patch on JDT.
I won't move away from eclipse workflows and project management, the context switch is more expensive than any language benefit.
I'll keep checking for comprehensive Go support in Eclipse, but until then it is a showstopper.
More common main page: http://code.google.com/p/liteide/ Downloads: http://code.google.com/p/golangide/downloads/list Code: https://github.com/visualfc/liteide
You're letting your tool own you rather than you owning your tool.
Autocomplete / suggest broken on Windows. There is something about a fix by running an external server. I gave this a go, sending a few hours piecing together forum comments, but couldn't get it to work 100%.
edit: oops, I misread your comment. At first, I thought you found an alternative. I'd be open to working with you to improve the experience. I do not use windows personally.
It is called gocode (https://github.com/nsf/gocode). Pretty much all Go environments require gocode - the directions for Eclipse (which I don't use anymore) are pretty clear too: http://code.google.com/p/goclipse/wiki/GocodeIntegration
At some stage the context switch becomes too high and you give up. As I said "meaningful Eclipse Support", and digging around to get gocode working harms this effort.
Erlang has a great concurrency model, but it's fairly clumsy for writing procedural code of any complexity, which makes it harder to pick up too.
The libraries maybe (and the runtime). The language, as per semantics and syntax, is more or less the same.
>Why not use C? Because C has no sensible packaging system, is unsafe, requires manual memory management, and offers a degree of control that is unnecessary for most tasks.
But is absolutely essential for most tasks C is used. For all the others, why not use a higher level language like Python?
>Why not use Java? Because it is verbose and picky and basically forces you to use an IDE to get anything done, etc etc.
Some people are not "forced": they choose to use an IDE, and wouldn't have it any other way. It is like telling some Smalltalk guy: "Smalltalk forces you to use the smalltalk image editor/environment" -- so what? He is perfectly fine with it. Heck, lots of people even like using dynamic languages with an IDE (and more would, if there was better type inference and assistance).
>If there were nothing wrong with these languages (they're the main ones we use at Google) we wouldn't have developed Go.
Well, the main reasons for Go, as stated in the official pages (the Golang FAQ), are not very convincing or exciting: No header files, faster compilation, parallelism, garbage collection, lighter type usage.
What C programs are you thinking of? Thinking of significant C programs that I have used (bash, apache, gcc, and many more), I can only think of a few that wouldn't be easier to write and maintain were they written in Go, without suffering a meaningful performance penalty. Funnily enough, a lot of the uptake of Go has been from former users of Python, Ruby, and other dynamic languages; they attracted to Go's simplicity, safety, and speed.
But really there's a lot more to Go the faulty dichotomy of "dynamic vs static" (or Python vs C, whatever). This is worh reading: http://talks.golang.org/2012/splash.article
>lots of people even like using dynamic languages with an IDE
Agreed, and I have nothing against IDEs. I have just found that I can't comfortably write Java code by hand. There's way too much boilerplate. In my experience an IDE is essential writing Java code efficiently, and I don't think that's a good thing.
>not very convincing or exciting
Depends on your definition of exciting. Since I've been writing Go code I've been more excited about programming than ever before.
As much as I love high-level programming, many of the most interesting and important problems are ones where a "small" constant factor is the difference between great and mediocre.
On most algorithmic benchmarks Go is 2-3 or more times slower than C/C++.
And parsing something like a large C++ codebase with a GC language like Go would result in tons of memory used (and slowness).
Heck, even Go compiling Go programs gets OOM'ed sometimes in Linux.
For a project a couple of years ago, I needed to use OpenCV and the Go bindings were quite immature. I just switched to C++ (for that project) and never really returned.
But now that I think about it, whenever people that are interested in being introduced to coding (it happens a lot on campus) ask me "what language should I learn?" I've never answered Go. I'm not sure if most people would.
Certainly not C or C++, if you're discounting Go. I'd also discount Java and C#, since they're syntactically quite similar to Go. Certainly not erlang.
So... python? ruby? While I like those languages, I feel that the lack of a compiler is a pretty big hindrance to new programmers. Statically typed languages can catch many errors that produce some truly strange error messages in dynamic languages.
However, Go seems to be very good at what Python/Ruby/Node.js/Perl are good at. It provides a simple, clean language with more guarantees and better runtime (mainly the cheap goroutines). I see Go taking some of their role for web development, simple tools (Go programs produce a single binary - very easy to distribute).
Apart from Google (who uses it for Youtube), Go hasn't really been used in large projects. Maybe 1.1 will change that. I might give it another shot, too!
I don't know how large each of these projects is, but a growing number of companies are using it for serious projects:
Iron.io: How We Went from 30 Servers to 2 with Go http://blog.iron.io/2013/03/how-we-went-from-30-servers-to-2...
Behind the Scenes: Big Data at Torbit http://torbit.com/blog/2013/02/19/big-data-at-torbit/
pool.ntp.org DNS server in Go http://news.ntppool.org/2012/10/new-dns-server.html
Juju at Canonical http://www.reddit.com/r/programming/comments/18atce/juju_can...
Go at bitly http://word.bitly.com/post/29550171827/go-go-gadget
CloudFlare blows hole in laws of Web physics with Go and Railgun http://arstechnica.com/information-technology/2013/02/cloudf...
dl.google.com now served by Go https://groups.google.com/forum/?fromgroups=#!topic/golang-n...
Go At Conformal https://www.cyphertite.com/blog.php?/archives/7-Go-at-Confor...
Go at Novartis https://plus.google.com/114945221884326152379/posts/d1SVaqkR...
Go at the BBC http://www.quora.com/Go-programming-language/Is-Google-Go-re...
Go at SoundCloud http://backstage.soundcloud.com/2012/07/go-at-soundcloud/
Go at CloudFlare http://blog.cloudflare.com/go-at-cloudflare
Go at Heroku http://blog.golang.org/2011/04/go-at-heroku.html
Building StatHat with Go http://blog.golang.org/2011/12/building-stathat-with-go.html
These are problems I have seen with larger java projects with unused imports, unused variables, library dependencies, long compile times, etc. I think that Go's niche is for extremely large projects, but it remains to be seen if it will work.
Your suspicions are well-founded! http://talks.golang.org/2012/splash.article
I think it's very D-unlike. It's very small and simple.
Want high performance and full control? Use C (or C++). Want your code to be easy to maintain by an average Joe? Use Java or C#. Want your code to be concise? Use Clojure. Want extreme typesafety? Use Haskell. Need to use both OOP and FP? Use Scala. What question to ask so the obvious answer would be "Use Go?"
I basically see it as a midpoint between C and python, that offers most advantages of both.
From C: Low memory use, fast execution, type safety/ compiled.
From python: Easy/fast to learn/read/write, no slow compile, GC, memory safety, good standard libraries
It also does concurrency better than python (/anything else?). What would you say better fits these criteria? Certainly not the JVM languages (memory) or Haskell (accessibility).
I was immediately dismissive of Go when I first heard of it a few years ago. I only started looking at it again a couple months ago when I ran across the 'splash' article. [1] The attention to detail with regards to the language, the standard library and the tooling really impressed me.
Yes, in many ways Go is low level. It doesn't break much new ground from a programming language design perspective. It doesn't provide a lot of features, but what it does have is well integrated. At every turn, language features were added or left out based on the larger software engineering perspective, rather than what can produce the most succinct or elegant code.
What question to ask so the obvious answer would
be "Use Go?"
Writing services in a SOA tech stack.The only things that Go has over Modula-2 are interfaces, single declaration modules and GC.
Single declaration modules and GC were part of Modula-2 successor, Oberon in 1986, while Active Oberon in 2001 added Tasks and Interfaces to the Oberon language family.
All of these languages were used to built operating systems used for real work at Zurich's Technical University.
Because that's exactly one of the niches of Java -- enterprise programming by average Joes. It was even a stated design goal of the language back in the day.
In languages with exceptions, potentially any function call you make could throw, and you don't know, because it could be 6 levels deep in the call stack. (Even Java's checked exceptions don't help, since someone down the line inevitably just rights "throws exception" and the screws everyone up the stack).
Go is really fast to pick up, it's pleasant to write code in, and yes... it's boring. I think that's it's biggest feature. It gets out of your way so you can produce a product. Why does the language need to be interesting? Isn't it more important that it can build interesting things quickly and reliably? Go does that.
It also means that you don't know how much of your code executed. Have you written that file to disk yet? Maybe you need to clean it up now? Is that socket still open? or maybe you didn't get that far in the code?
In code that cares about handling errors, you end up with a lot of try/catches around individual functions that you know can throw... this is no different than go's if err != nil code.
try {
v = ThisCanThrow()
} catch (Exception ex) {
// handle this specific failure
}
v, err := ThisCanError()
if err != nil {
// handle this specific failure
}
Because Go forces you to handle the error at the site where it is produced, error handling ends up being much more robust and specific. You can't just "let 'em fly" and make someone else deal with random exceptions up the stack. This almost always produces better code in the end.Believe me, I understand where you're coming from. I've been using exceptions for 13 years in production code. I initially skipped Go pretty much solely because of the lack of exceptions. But I am really glad I gave it a second chance, because, damn, it is good.
Because of multiple returns, the normal flow of execution isn't indented. I find that this makes it easier to skim Go code in practice.
Your explanation does seem to make the case for this type of error seem somewhat sensible, maybe I'll give Go another try. Are methods which return errors and the types of errors returned clearly documented/visible?
func Demo (s string) (string, error){...}
When called, that is guaranteed to return a string and an error value (OR nil).Go does exception handling with panic, recover and its reflection syntax.
Even then discouraging panics is very different from not having them.
However, the direction the language took ended up being quite predictable and somewhat of a bore. The problem with Go is that it doesn't seem to fit any particular niche. Some other design decisions were questionable (no exception handling, for one).
I kind of like Go, but I haven't used it for years. There's no real reason to NOT write something in C (or, rarely, C++) or Java, or if I need some serious scaling, Erlang (or just use either something like libevent for C or Kilim for Java).
Go is very D-like. D, like Go, can't really find its niche. If Go or D were more idiomatic, perhaps they would be adopted in early programming classes (high schools and colleges -- like Python, for example), but even though goroutines, channels, and fast compilation are interesting concepts, they aren't really enough to detract from writing in the many other languages that do just about the same thing (and are a lot more popular).