Google Releases Its Own Programming Language, "Go"
Google has just announced the release of a new computer programming language named, quite creatively, Go. It is similar to the C family of imperative programming languages, but strives to be as simple in syntax as dynamic languages like Python and JavaScript. It aims to be very fast (both at compile time and at execution), safe, concurrent, memory-managed, speedy (in terms of developer productivity) and Open Source. Quite interestingly, some of its main authors are programming demigods Rob Pike and Ken Thompson.
Here is an example of a simple web server written in Golang:
package main
import (
"http";
"io";
)
func HelloServer(c *http.Conn, req *http.Request) {
io.WriteString(c, "Hello world!\n");
}
func main() {
http.Handle("/", http.HandlerFunc(HelloServer));
err := http.ListenAndServe(":80", nil);
if err != nil {
panic("ListenAndServe: ", err.String())
}
}
I’m not sure what I think about Go yet; all of its features look extremely attractive, but I can’t shake the feeling of something being “off” somehow. For instance, I’m not particularly fond of the function name capitalization, and there are no generics/templates in the language (yet). I suppose the former might largely be a matter of conditioning, though.
One aspect of Golang that has really impressed me is how fast it compiles; you really have to see it to believe it. Projects with several thousand lines of source code compile in less than a tenth of a second on an average workstation. Sadly, I think this might mean we won’t be having as many office chair sword duels in the future:
Have a look at the Google Go TechTalk for an introduction to and overview of the language:
Note that Go (or Golang) isn’t to be confused with the Go! Programming Language. Why Google chose an almost identical name, or why they chose such a common word at all, I don’t understand. I’m rather fond of the term ‘Golang’ since, well, it makes sense. Ericsson previously made its own language, Erlang, so it’s only a natural addition.