1. They got concurrency right. Writing ostensibly blocking code and letting the runtime yield in the background is The Future.
2. Implicit interfaces and formalizing "composition over inheritance" is the right way to think about reusing functionality.
3. Deployment is stupidly easy with zero-dependency binaries.
4. The cross-compilation tool chain is dead simple. (excepting CGo)
5. The tooling around Go's handling of code (godoc, go vet, go fmt, etc) is superb. Enforcing a one-true coding style makes foreign code easier to understand.
That being said, Go is missing the expressiveness that you expect coming from higher level languages like Haskell/Python/Scala. In many cases, it is a unnecessary step backwards on the thought-to-code spectrum. Not having things like generics and list comprehensions makes my code more verbose and more difficult to understand.
Certainly Go will evolve, although the authors often seem perhaps a little too resistant to change. I suspect that Go's popular successor ten years from now will have stolen Go's best qualities and iterated faster to include the higher-level language niceties that we expect.
I have a longer blog post to expand on this later.
Everyone talks down on C++ but it's one of the few languages that gets generics right. The only language with implicit RAII (not explicit like C#/Java). The only language to put into practice 0 cost abstractions.
You mean a Go++, designed by committee with all language features known to man thrown together, ranging from meta-programming to dependent types, trying to please everyone, and as a result pleasing no one, and everybody will wish for a simpler language?
Lots of C++ programmers do NOT wish for a simpler language.
Not better enough - and no new platform to carry it unlike JS, Perl, Ruby, Python, PHP, Java (web); Objective-C, Java (mobile); Java, Ruby, Python (cloud).
The problem is that people don't like to switch. They'd prefer their present tool to improve, and they'll support that. So the only way a language can achieve ascendency is when users don't switch. That is, new users. During rapid adoption of a platform, a significant majority can be new users. And that is the only time a new language can take over.
NOTE: it may appear there's an exception with flavour-of-the-month frameworks etc, but this is a combination of rapid turnover of developers/projects in specific areas, plus the enthusiast/techie kind of developers who love to switch (the ones always excited about the newest tech for its own sake, not for its long-term practical benefits: think inventor, not investor). These developers cannot form the basis of language's future, because they will quickly switch to the next new thing.
But C++ suggests another path to language survival: present it as an "easy-to-learn" (it started that way) superset of an existing language that addresses a weakness. It's C! With classes!
The future may not be particularly interested in Go. It doesn't open interesting new research avenues. If it becomes a proverbial "100-year language", it's going to be the legacy mess that some poor soul will hate to maintain in 2110.
I'm not going to be around in 2110 and I'm not a researcher, so I like using Go.
I personally see much more of a future with Rust, since it actually has a chance of replacing C++.
It suffers a bit from the fact that dynamic languages like Python are (and will always be) nicer and more productive for hacking around in when performance is not a concern; and from the fact that you cannot (yet) beat C for (single-thread) performance.
So, if productivity is everything: use Python, or your dynamic language of choice. If performance is everything, use C (or C++, if you really must).If, on the other hand, you want a nice balance between (good-enough) productivity and (good-enough) performance, Go is a great bet.
I bet that in 10 years time, once the hype has died down, Go will be seen as a middle-of-the-road language for middle-of-the road applications. A low-risk, conservative, sensible, and ultimately boring choice.
Which is great, because that is exactly what Go is trying to achieve.
In ten years, Go will be seen as what Oberon is seen as today: essentially all the things you mention, plus the fact that there will be a dedicated community of people who like the no-nonsense "do more with less" approach that is peculiar to this family of languages and don't want to live without it. Plus, Go will most likely have some evolutionary continuation anyway.
I think it's more likely that in 10 years, Go will be the new Java. Big companies (besides Google) will use it, Hacker News will hate it, consultants will write books about it, and language geeks will be trying to replace it. Recall that Java also had a no-nonsense "do more with less" approach. The problem is that once a language gets popular, it's inevitably pushed into more and more domains where it's unsuitable, folks need to learn it to earn a living, and all the folks who define themselves by what languages they know will move on to greener pastures.
The only way a language can remain cool for decades at a time is to "avoid success at all costs", which was actually one of Simon Peyton-Jones's goals for Haskell (which has remained remarkably true to that ideal). Otherwise Stroustrop's Law kicks in: "There are two kinds of languages: the ones nobody likes, and the ones nobody uses."
https://news.ycombinator.com/item?id=6527104
My pet theory on why is that both of these languages didn't try to be middle-of-the-road, good-for-everything languages, they were created to solve a specific problem and were very well designed for that niche. So programmers use C for systems programming and when they need to be close to the metal, they don't use it for large applications with ambiguous requirements - and so all the hate that the latter engenders gets directed to C++ and Java. And programmers use Python when they need to prototype stuff, script things, or write a quick tool where performance doesn't matter - and when performance does matter, they either end up calling out to C (which is actually good for that) or they end up rewriting in Java and cursing out that language.
Oops. I meant "seen technically", not "seen socially".
I think it's more likely that in 10 years, Go will be the new Java.
I'd rather think of Go as the new C. :-)
Also, as far the "do more with less" and "no nonsense" stuff is concerned - have you seen the spec of Java on one side, and the specs for Go and Oberon on the other? There's quite some difference.
List comprehensions are one of the most obvious things. LINQ and Haskell and co have shown that this is absolutely doable with a static type system.
The lack of genericity is one of those things that will be argued about for the lifetime of Go, I think. Python doesn't need it because of the dynamic typing but the same problems are solved to some extent by the compile-time-duck-typing enabled by its interface system.
I'm not sure I agree re productivity. One on project I reached 30,000 lines of Python, collaborating with 3 other people remotely. Some things would have been a lot easier with static typing. I think.
type(3 * 5) => int
type(3.0 * 5) => float
type(3 * 'foo') => string
type(3.0 * 'foo') => TypeError1. What object calls the operator relevant method
2. Looking at the code of the relevant operator call, we'll see something like if type(obj)==str , do X . so depending on the type of obj , we can deduce output type automatically .
Another option is to use the approach mypy uses: let the language mix static type and dynamic type freely, and if we cannot determine type, let the code by dynamic , with the relevant warning .
Yes mypy isn't written yet, but it would be interesting to see how useful this approach would be.
The first is that multiplication is...well, not always commutative in Python, but it has two operands and either of them can be the method receiver. For example:
type(5 * 3) => int
type(5 * 3.0) => float
type('foo' * 3) => string
type('foo' * 3.0) => TypeError
More generally, multiplication might be a method on either the right or the left type. If __mul__ is defined on the left operand, the interpreter executes the code in it. If not, and __rmul__ is defined on the right operand, the interpreter executes the code in it instead. If neither is defined, the interpreter throws a type error. So typing a * b requires knowing the types of both a and b and merging a set of rules for each of them.The other problem is that you cannot in general determine the type of an expression by inspecting code, unless you apply some rules to the legal expressions in the language. For example, take this code fragment:
def foo(fn):
if typecheck.static_type(fn) == int:
return 'a string'
else:
return 0
Assuming typecheck.static_type is our hypothetical typechecker and it operates on function objects. What should the type of foo(foo) be?I suspect that any working solution involves some sort of constraint solver that gathers up all the constraints, simplifies them, determines if they're compatible, and then outputs a list of possible types it could be, each subject to certain assumptions on the input types.
If typecheck.static_type evaluates type on an object , typecheck.static_type(foo) returns type 'function'. And our function will return 0 , meaning type == int.
if typecheck.static_type does something else , more complex , we could always tell our tool that fn is dynamic.
The problem with giving up and returning 'dynamic' is that dynamics tend to propagate through the code if you're doing anything moderately complex. If we give up, then any expression that calls foo() now typechecks as 'dynamic', and any expression that calls one of them typechecks as 'dynamic', and so on. You end up with a typechecker that doesn't tell you anything useful about your program, other than that it was dynamically typed.
If this is restricted to a few special cases like, say, Django ORM classes or namedtuple, it's not a huge problem, because you can hardcode in specific rules for them (or put in a plugin mechanism). But tricky typing rules abound even in the basic language features; as mentioned above, multiplication does not even have concisely expressible typing rules in Python.
The low-risk, conservative, sensible and boring choice exists today. It's Java.
And as enterprises adopt functional programming via Scala/Clojure it will only cement those characteristics.
Go has made me enjoy programming again -- I find it very freeing not to have to use Java or .NET and memorize 40,000 builtin classes. Yes, Go is similar to Java in terms of its being a "middle of the road" conservative language. But (a)it's conservative for the 21st Century, rather than the 20th, and (b)ditching the virtual machine and bloat of Java is a good thing IMO.
For everything else no. The JVM is going to continue to dominate for medium to large apps with Scala and Clojure offering something new and original whilst allowing for existing code to be reused. And for smaller apps it's hard to look past Javascript.
It's the language which doesn't have important modern language features, like generics, and I won't ever use it unless these feature are added which is highly unlikely.
Languages like Mozilla Rust seem to me to be a more adequate replacement for C++.
Authors of Java didn't include closures and generics despite the fact that they were aware of them. They thought that these features are too complicated for ordinary developers. Look what this lead to, we now have generics and closures, but they made the language much more complicated and hacky than it would be if they would have integrated into it from scratch.
I personally think that Python is starting to go the way of perl. It's becoming more and more of a mess (perl was a mess to start with, but that was actually touted as a benefit). The last python project I worked on had over 60 separate "pip" requirements, many with specific versions, and deploying on anything but one specific version of one specific linux distro was an exercise in pain. I realize that's just an anecdote but if python wasn't starting to get uncomfortable there would not be so much buzz around Go.
Still could see myself using it for specific use cases.
But for the future I'd wish for something cooler to win :-)
Edit: check out the sort module and decide for yourself http://golang.org/pkg/sort/
It has some interesting, if confusing, properties. But why not just let me write
list.sort(function(a,b){ return 1, 0 or -1...}) like JavaScript does?
While the examples in the sort module are perhaps more generic than necessary (hence the interesting but confusing properties), any sort still requires the definition of 3 functions, and they can't be defined inline (on the fly) either, afaik.
func (s Organs) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
http://golang.org/pkg/sort/#example_Interface
Also note two things:
- This is the efficient and type safe way to handle polymorphism in Go
- The standard packages documentation is very nice with live, runnable examples
Maybe you can create a better way, but it is not implemented in the sort package by default.
Also I suppose you need to "convert" your list to some other type with the said functions provided (dervied from the standard go lists, forgot the name). Maybe that is a standard go mechanism, but it still amounts to more lines of code.
Maybe complicated is the wrong word, longwinded might be better?
Does it have a future outside google? I'd say yes, even in the enterprise world, mostly in mixed architectures where it could be used to build a lower layer that handles networking/transaction processing/jobs handling (replacing python,ruby,etc...) while upper layers could be built with a functional language (based on the jvm? clojure?).
Since someone mentioned Python here.. my go-to language has always been Python lately, but large Python projects tend to often converge into a wtf mess; and there's also all kinds of performance issues... I've recently (to my shame) discovered D language which is kinda like C/C++ on steroids without all the ugliness and verbosity, with a mix of Scala/Python. Type inference, concurrency, first class functions/arrays/maps, runtime reflections, mixing, templating, compile-time evaluation, it's got it all. Kinda like Go, it also falls inbetween C++ and Python, but much closer to C++.
Now if I was Google I would be seriously looking at getting it into the android ecosystem so people can develop in GO as well as C for low level system codeing above the abilities of java on android.
That said I'm a shell prompt type of chap and with that somewhat biased and blinkered in languages that you can code in vi. Certainly visual programming interfaces will have there day one day. After all much code is down to string libarys together and then stringing those functions/modules together until your pretty much coding lego style using off the shelf bricks with rare occasions of custom bricks being needed. That is still a way off from mainstream acceptance and closest break out into mainstream would of been the old mac card stack system (which was neat in its days though well dated now).
So methods and approaches to coding change over time and languages adapt and some better designed to handle changes. C been good and the same could be said for GO by definition.
But another way to look at this is what out of COBOL or GO will be around in years from now and you then get down to the main crux - is it used in production and needing code to be maintained and with that yes it is. Though different area's and platforms GO easily available for and known are different from COBOL (mainframe legacy bias) systems. If you asked a Linux dev to install GO then they would just do it, ask them to do the same with COBOL and they will be hitting google with a bewildered face. Yet both exist and are available, just different mentalities keep them going.
Or are you suggesting they rewrite the API for Go? My knowledge of the internals of the Java parts of Android is limited, so I could be wrong, but that feels like a huge task.
Hackish, but it works.
Channels and blocking until a result is ready is really a big plus.
Overall, I am very pleased with switching from Node.js to Go, but YMMV.
Word seems to be spreading. There's certainly a growing interest.
http://www.google.com/trends/explore?q=golang#q=golang&cmpt=...
The syntax might look weird in the first place, but once you get used to it, it's actually somewhat sexy, given the fact it's compiled and statically typed.
Since go has a very good solution for concurrency, compiling takes seconds and it's already adopted in a few well known companies besides google (heroku, canonical, shopify and more), I think it will gain even more traction (already under top 20 languages on github).
Plus: The standard library is very impressive and huge. You can build many different web apps and daemons without any external library involved.
I kinda miss class based inheritance tho.
The language is very good and has excellent support and libraries.
People, though, are somewhat mysterious...
We will be using GO in our toolchain in the future aswell.
So far, no mainstream operating system includes garbage collection and there seems to be nobody who considers it a good idea.
(except the Oberon guys, maybe)