Join 3,564 readers in helping fund MetaFilter (Hide)


Python + C = Go. Google's Programming Language
November 11, 2009 9:06 AM   Subscribe

Say hello to googles new concurrent programming language Compiles faster than c/c++ and runs just as fast. Garbage collection + concurrency included
posted by FusiveResonance (58 comments total) 25 users marked this as a favorite

 
Somehow I think it's a pity they didn't pickup an existing language and it's community but decided to start again from scratch. This will draw support away from other language communities.

Personally I don't see the resemblance to Python since they use accolades. Also I'm not very excited by the continuity from C. A new language is a chance to rethink some things.
I wonder how the statically typed version of duck typing will work out. They want to deemphasize the importance of relationships between types. I can see why. But I do wonder whether making relationships implicit is the answer; there's still a dependency (by set of method names) but you have to guess at it.

Anyhow; anything Google supports, and it's not quite obvious they support this wholeheartedly, will gain widespread support I expect.
posted by jouke at 9:18 AM on November 11, 2009 [1 favorite]


I installed this and messed with it some this morning; some really neat syntactic sugar (the cases statements for switch() are pretty awesome), but some of the stranger (to me, at least) bracketing requirements put me off.

Also, no exception handling and it implements goto? This bespells doom.
posted by VeritableSaintOfBrevity at 9:20 AM on November 11, 2009 [1 favorite]


http://code.google.com/p/go/issues/detail?id=9 seems to show that there previously was a language named 'Go!'.

I find this funny because Google apparently didn't Google 'Go' as a programming language name prior to release.
posted by jangie at 9:20 AM on November 11, 2009


Here's what they had to say on Lambda the Ultimate (a programming language blog):
By combining dynamic features, safety, garbage collection and efficiency in a single language and environment, Go claims to remove the reasons why programmers end up building systems using multiple languages. A brief look at Go shows strong C origins with nice support for "goroutines" - essential sequential processes communicating using channels. I don't quite get the "safety" claim of the language since you can take the address of an uninitialized variable in Go. It could qualify as a "C with concurrency" language I think.

Go already has a great set of packages that should make it immediately usable as a pragmatic language. (The terse package names are very reminiscent of Erlang's package structure.) It even has a package for interfacing with Google Native Client (NaCl) for audio/video access.
I like static typing. I read a comment on one programming blog a while ago where the author said that his Scala code required far less debugging and was a lot less likely to fail regression tests then stuff he was writing in (IIRC) Ruby.
posted by delmoi at 9:24 AM on November 11, 2009 [1 favorite]


+1 for static typing
posted by Artful Codger at 9:27 AM on November 11, 2009


I'm kinda seeing this as a funny rebuke of python's whole block by indentation thing, given that Google has van Rossum and is probably the biggest driving force behind Python (App Engine, etc). I'm installing the compiler now.
posted by xmutex at 9:30 AM on November 11, 2009


The concurrency model is interesting.

Don't get confused on Go vs. Python. Google has a lot of very smart engineers who have different opinions. Go comes from Rob Pike, Ken Thompson, etc: very much a Unix / Plan 9 continuity.

These days Scala seems to have the most mindshare for cool new language that you can actually use to build stuff. It helps that it builds on Java, the JVM's stability and performance is a great place to begin. (See also: every Ruby or Python server ever).
posted by Nelson at 9:36 AM on November 11, 2009 [2 favorites]


Hmm, they don't do generics. Which pretty helpful for type safety.
posted by delmoi at 9:38 AM on November 11, 2009


Sounds neat, but googling for help or information is going to be nearly impossible. All the results are going to hits on things like "Go to next page."
posted by treepour at 9:38 AM on November 11, 2009 [5 favorites]


Implicit static duck typing dates back to CAML (predecessor to Ocaml), and may have been present in standard ML (I am not certain on this one, I never learned standard ML).
posted by idiopath at 9:38 AM on November 11, 2009


Aside from the 'ho hum, another programming language' reaction, I note that Rob Pike is the guy behind it. His involvement with Dennis Ritchie and Ken Thompson is notable, but he doesn't have a strong record of introducing new technologies that stick. The whole Inferno/Plan 9 stack doesn't seem to have gone anywhere except back into his other projects.

The slashdot thread has some (surprisingly) good commentary on it, but the overall reaction come down to "the only reason we're noticing this is because Rob Pike and Google are behind it".
posted by fatbird at 9:39 AM on November 11, 2009 [1 favorite]


No support for us knuckledraggers on Windows? Meh.
posted by crapmatic at 9:40 AM on November 11, 2009


I love this diff, given who committed it.

click [+] to see the code. oh, and <spoiler> mouseOver the link above </>
posted by LanTao at 9:43 AM on November 11, 2009 [21 favorites]


Go was co-created by Unix pioneer Ken Thompson!
posted by bobo123 at 9:45 AM on November 11, 2009


Every time an interesting new language comes out, I check on the development of Perl 6.

* checks development of Perl 6 *

nope, not yet. I deeply love perl and it vexes me no end that its been under development for oh, about a decade now. During this time, languages have come up with similar or better paradigms, safer, easier, etc. etc. etc.

Aside from all of that, it seems like concurrency is really the new hotness; PLINQ is all that our MS dudes are talking about; they showed us a 256 processor SQL server with tons of .NET 4.0 stuff running in parallel, how all future scaling is going to be "out, not up" and so on.
posted by boo_radley at 9:49 AM on November 11, 2009 [2 favorites]


I am not really seeing the Python resemblance. Plenty of Modula, Pascal, and ML similarities, and yeah Python used features from those languages too, but the Python-like features seem to be pretty much syntactic sugar rather than language features.

Also: the biggest most awesome thing I see here is that it is high performance language that uses closures.
posted by idiopath at 9:50 AM on November 11, 2009 [1 favorite]


> I find this funny because Google apparently didn't Google 'Go' as a programming language name prior to release.

So you're complaining they didn't Go ogle?
posted by ardgedee at 10:00 AM on November 11, 2009


+1 for Scala.

If you're a Java developer, you really, _really_ need to take a look at Scala. It runs on your JVM, can inherit Java classes like any other Java code, but native Scala code runs faster than the corresponding Java code, it is easier to deal with concurrent threads via the concept of actors, and the syntax eliminates a _huge_ amount of Java's verbosity. Basically, nearly anything you can do in Java, you can do in Scala in half the code. IDE support is thin but maturing extremely rapidly; IntelliJ has pretty decent support, and Eclipse is catching up quickly.
posted by mark242 at 10:04 AM on November 11, 2009 [3 favorites]


@boo_radley

I hear you. I think the perl community is treating Moose and Catalyst as the new perl. But I can't beef too much with Perl 6, since I'm not helping. I'm busy trying to catch up with the Moose/Catalyst/DBIC work that's been done by serious folks. ...and playing with extjs
posted by drowsy at 10:14 AM on November 11, 2009


Hard to say right now how great or not this is, but I like the syntactic sugar: switches and multiple return values. And closures are always nice.

I don't know if the channel model for concurrency is new or not, but it does sound like a good idea. I deal with threads very rarely, though.
posted by ignignokt at 10:17 AM on November 11, 2009


blaze a blaze golang a lang a lang lang now [mov].
posted by eccnineten at 10:20 AM on November 11, 2009 [4 favorites]


No exceptions. No generics. No thanks.
posted by Civil_Disobedient at 10:27 AM on November 11, 2009


I was vaguely on it when it first came out internally to Google but I lost interest.

I was sort of used to the syntax from Sawzall but there were a lot of things I didn't like about it... very specifically the lack of exception handling.

R. Pike's response to my requests for it was "return a condition code as part of a tuple" which IMHO is totally stupid. It's not just that you won't check, but if you do suddenly start to report an error at the bottom of your stack, you have to pass that code back all the way up your stack! Not to mention the endless if/goto statements that result...
posted by lupus_yonderboy at 10:30 AM on November 11, 2009 [1 favorite]


They still develop Perl?
posted by Nelson at 10:31 AM on November 11, 2009


I like the interface stuff, and the Ada-style tasks "goroutines/channels", and especially the function types and multiple return values. But, really, no exceptions or generics?

Also, maybe I've been in C++ land too long, but it seriously frightens me that there's no const qualifier, especially since maps are always passed by reference. How are you supposed to guarantee that you won't modify a map? With a comment?

This thing seems a little half-baked.
posted by equalpants at 10:31 AM on November 11, 2009


Strong types, compiles fast, runs fast, no pointers to memory that you can shoot yourself with?

Sounds like CMU Common Lisp!

You can pry my Symbolics keyboard from my ... oh wait, I gave it away. Darn.
posted by zippy at 10:31 AM on November 11, 2009 [1 favorite]


Yeah, one of the first things mentioned in that Slashdot discussion (at least at my mod setting) is the lack of built-in libraries.

That drives me crazy. A lot of people of in this industry inevitably end up working on other peoples boxen. And trying to sort through all the libs and installations every single project, not to mention getting permission to install, is enough to make you tear out your pubes.
posted by lumpenprole at 10:36 AM on November 11, 2009


> make "you tear out your pubes"
*** No rule to make target `you tear out your pubes'. Stop.
> _

posted by zippy at 10:42 AM on November 11, 2009 [8 favorites]


+1 for static typing
+1 what?
posted by Flunkie at 11:04 AM on November 11, 2009 [53 favorites]


very specifically the lack of exception handling

exceptions are only for people whose code encounters unexpected conditions. I always write code for every possible situation. After 12 years I'm nearly done the command line parser once I get the H1N1 handling coded.
posted by GuyZero at 11:11 AM on November 11, 2009 [6 favorites]


+1 for static typing
+1 what?


HA!

This may be the funniest smartass programming retort ever.
posted by weston at 11:32 AM on November 11, 2009 [1 favorite]


This language was not developed as part of any master plan by Google. It is a 20% project. It may be cool, it may not be. But calling it "google's new language" is a bit hypeish. It's not as exciting, but perhaps more realistic to say "here's a new language, invented by some guys in their spare time, and oh, those guys work for google."
posted by mrgoldenbrown at 11:35 AM on November 11, 2009


Perl 6 has been making a lot of progress recently. Check out the Rakudo Perl status graph. Of course the most interesting thing about Perl 6 is the Parrot VM. Parrot has some support for a lot of languages (Perl 6, Python, PHP, Ruby, Java, Lua and a .Net bytecode translator), but it won't be really exciting until until the support for those languages is complete (if that ever happens).

Back OT, I generally see the introduction of new languages as a good thing. Go will get some traction because of it's origins, but whether it really catches on or not will depend on its own merit.
posted by Loudmax at 11:39 AM on November 11, 2009 [2 favorites]


I dunno if it's a 20% project - Pike is a researcher. His job is to research new stuff. He doesn't have to worry about keeping the lights on like the rest of us mere mortals.
posted by GuyZero at 11:40 AM on November 11, 2009


Scala code required far less debugging and was a lot less likely to fail regression tests then stuff he was writing in (IIRC) Ruby.

Test and typing have a lot of overlap; you could argue that regression tests are essentially elaborate type definitions. Given that overlap, it's not surprising to me that a strong type system can catch issues before they get to the tests, but I don't know how much I care. At least in Java and C over time I've found myself making fewer mistakes that are type issues and bumping up against the type system more often... and so I've drifted more towards the scripting camp. I've been bitten a few times by some implicit conversions and type issues, but now that I'm aware of them, it's rarely a big deal. It'd take a lot to convince me to go back.
posted by weston at 11:44 AM on November 11, 2009 [2 favorites]


Now google can get a taste of what we go fans go through (ha ha) whenever we're doing a search.
posted by callmejay at 11:55 AM on November 11, 2009 [3 favorites]


Generics and exceptions remain 'an open issue,' according to the FAQ. That speed of compilation, though: whoa.
posted by willF at 11:58 AM on November 11, 2009


And, I do think it's important to not view it as "Google's language," but as a (research) project in and of itself.
posted by willF at 12:01 PM on November 11, 2009


Concurrency is one of my main legs up as a FPGA designer over the SW designers. lucky for me, as number of cores increase, FPGA sizes increase.

"Oh, you have 8 cores, so you can do 8 different things at the same time? that's nice, I'm generating 128 different control streams simultaneously."
posted by garlic at 12:59 PM on November 11, 2009


idiopath: "Implicit static duck typing dates back to CAML (predecessor to Ocaml), and may have been present in standard ML (I am not certain on this one, I never learned standard ML)."

Type inference has been part of ML since the start. The standard argument against static typing is that they overconstrain things; everything works one day until you need data bigger than you allocated bytes for, and then you get to deal with overflow. Or you specify too much and the compiler can't optimize without violating a constraint you later discover wasn't needed. The ML stuff lets you apply static program analysis without losing generics, but I've yet to figure out how to use it to divorce machine types (int, float, bigint) from categorical types (number, string). I'm guessing the solution is to always use bigint, but I'd want to see performance comparisons. Perhaps I'll find / do them myself.

If Google had perfected the concurrency problems in OCaml, then I might be interested. Go reminds me more of SPIN than python, given their use of channels and "goroutines". I suspect this, combined with static duck typing, is intentional.
posted by pwnguin at 1:16 PM on November 11, 2009


Perl 6: Proof that a bunch of hippies can't get shit done.
posted by mrnutty at 2:36 PM on November 11, 2009 [2 favorites]


Somehow I think it's a pity they didn't pickup an existing language and it's community but decided to start again from scratch.

Didn't we used to bitch about embracing and extending when MSFT did it?
posted by Pope Guilty at 2:54 PM on November 11, 2009 [1 favorite]


I dunno, about the only thing I saw that I would trade for C/C++ was D.
posted by The Power Nap at 3:00 PM on November 11, 2009


GuyZero - It at least started as a 20%er. "Go began in 2007 as a group 20% project -- Google allows its workers to spend 20% of their time pursuing projects outside of their job responsibilities. In addition to Pike, contributors include Google engineers Robert Griesemer, Ken Thompson, Ian Taylor, and Russ Cox. "
(quoted from here)
posted by mrgoldenbrown at 3:00 PM on November 11, 2009


it seems like concurrency is really the new hotness

It seems less faddish than with dealing with coming up with good solutions of what to do with where processors have been going the last half-decade, no?
posted by Blazecock Pileon at 3:43 PM on November 11, 2009 [1 favorite]


Now google can get a taste of what we go fans go through

Oh lord, when I was in my go phase, I had a standing Google search that looked something like:

("go game"|"go tournament"|"go lessons"|weiqi|baduk|paduk|...) -(football|baseball|...)
posted by zippy at 4:03 PM on November 11, 2009 [2 favorites]


At least they fixed queries for The The.
posted by GuyZero at 4:58 PM on November 11, 2009


> Perl 6: Proof that a bunch of hippies can't get shit done.

No, it means they got shit done five times in a row.
posted by ardgedee at 5:01 PM on November 11, 2009 [5 favorites]


Eh, okay so:

This announcement is being taken in the wrong way because the vast majority of 'cool languages' which have been coming out are running on VMs or hackish interpreters (*cough* Ruby).

This isn't one of those: C is the big, big, monster of a systems language whose flaws and idiosyncracies other languages are built on. The cool rockstar developers with Buddy Holly glasses don't have the time, crazy talent, nor motivation to rebuild C, but computer science legends on the Google payroll might, and that's the big deal: this could be a fundamental language like C, except much better than C. C is not a god-given language or the only good abstraction of machine code, but to a lot of developers it seems like that, and we need geniuses with time to make something better, and who can realize stuff like the facts that garbage collection is needed and pointer arithmetic is almost inherently dangerous (see: libtiff implementations).
posted by tmcw at 6:15 PM on November 11, 2009 [4 favorites]


At least they fixed queries for The The.

I have confess that there was a single hard-coded line in the old Google music search that fixed a problem with The The. I simply couldn't figure out another way to do it...
posted by lupus_yonderboy at 7:00 PM on November 11, 2009 [7 favorites]


To be fair, the static duck-typing system handles a whole lot of the situations you'd want to use generics for.
posted by joegester at 7:51 PM on November 11, 2009


As someone whose most commonly edited program takes 9 minutes to link, I don't give a damn about the lack of generics if building stuff is faster.
posted by jewzilla at 11:10 PM on November 11, 2009


Modula, Pascal, and ML similarities

If you go to this review of Go, and skip down to the comments section, you can find one where an Oberon fan is pretty much accusing the Go language creators of stealing most concepts wholesale and dressing them up in C syntax.

the perl community is treating Moose and Catalyst as the new perl

It has been two years or so since I've done anything significant in Perl, but I can't believe I've never heard of Moose before now. Gonna have to pay better attention.
posted by weston at 1:23 AM on November 12, 2009


"the JVM's stability and performance is a great place to begin"

Ha ha ha ha ho ho ho ho ho. Ho.

OK, maybe it is time to check back in with the Java freaks, which I try to do every few years since the early '90s, but last time I had to deploy a modest-scale application framework in Java (the servers for TiVo's online applications, HME, four years ago), it took us six months to get rid of all the memory leaks and crashes in the best available JVM at the time. Also, Java finally mostly doesn't eat my laptop alive now that 6 GB of RAM is common. Even though "High Performance" has been a Java goal for over a decade, and people have been working on all kinds of crazy JIT compilers and whatnot, it has always slowed whatever computer I've been using to a crawl as it sucks up memory, inducing paging. And that's when it's not garbage collecting, when you can look forward to a couple of seconds of your UI locking up. I understand the philosophy of "cycles/memory are cheap and getting cheaper, go ahead and write for a few years down the line" but Java has been too bloated for that to work, since before it was named Java.

And I'm really not opposed to bytecodes/VM/auto GC. Smalltalk is really cool and usable.

So far, Go has been fun.
posted by Hello Dad, I'm in Jail at 5:19 AM on November 12, 2009 [1 favorite]


Tech talk (by Robert Pike!) on the language. Holy shit that compiler is stupid fast. Crazy stupid fast.
posted by chunking express at 8:11 AM on November 13, 2009


OK, maybe it is time to check back in with the Java freaks...

I can only speak for server side java on linux. To address some of your specific concerns: Allocate all the memory you plan to use up front (-Xmx == -Xms), so no resizing and absolutely no paging. I don't know of any current JVM crashing issues, and haven't encountered memory leaks in the JVM, at least with a single weekly restart. If your application needs to run 24x7x365 you may have a different experience.

Garbage collection is an ongoing issue. Pause times for CMS are typically 5-20 milliseconds. CMS still has an issue with promotion failure likely caused by fragmentation, that can result in a pause on the order of seconds when it happens but it is quite rare. Frequency can be reduced even further by having the initial working set size be a smaller fraction of available memory. I've heard good things about BEA's real time JVM, which is non-free but gives bounded pause times.

In summary - if you tune well and have the rest of your house in order it's a perfectly viable platform. I'm not going to say it's better or worse than any other language, but you can certainly write high performance / high reliability applications. Caveat: I can't speak for GUI programming, J2EE, application servers, or really anything but straight Java.
posted by true at 8:55 AM on November 13, 2009


I've downloaded the techtalk but haven't yet set aside the time to read it. But you know, its easy to write a fast compiler if you turn off all the optimizations. It would be interesting to see it on the shootout.
posted by pwnguin at 10:30 AM on November 13, 2009


Go language has appeared on the shootout. As usual, all the standard caveats apply. I will note that in this case, the contents appear to be purloined from the golang official source repository, so complaints about the competency of the benchmark author should be reflected upon carefully.

I'll use the pi-digits benchmark as an example. First note that the most important performance aspect here isn't the language but algorithm; if your convergence is slow it will suck. However, comparing the Go and C implementations they appear to be similarly structured. Which also works against them; if goroutines are supposed to be super fast and ready for the multicore era, you'd want to actually use them on these quadcore benchmark boxes. On closer inspection there are other benchmarks that do use multicore, but only when C does as well. And the comparison is not favorable.

Amusingly, the pi-digits build for C is faster than Go. In fact, it's comparable with the C++ compiler. Probably, the shootout isn't representative of common use cases because it's one big file and they're claiming intelligent grammar fixups, dependency resolution, and build ordering as a source of speedups.
posted by pwnguin at 1:34 PM on November 15, 2009


« Older Nabokov, Meet 50 Cent: Zadie Smith's Changing My M...  |  Stem Cell Awareness and The Bl... Newer »


This thread has been archived and is closed to new comments