Google's Go programming language
Google recently released a "systems" programming language called Go (not to be confused with the existing programming language called Go!) that is designed to be simple, fast, safe and concurrent.
Google give an impressive feature list:
- Accurate concurrent garbage collection.
- Goroutines and channels for parallelism and concurrency.
- Multiple return values.
- Fast compilation times.
- Structurally-typed object oriented programming.
- First-class functions.
There are two different kinds of compiler available to Go programmers. The more common 8g and 6g compilers for the x86 and x86-64 architectures, respectively, are simple "splat" compilers that translate source directly into assembler. These compilers offer fast compilation but the generated code is not optimized and is generally quite slow, often several times slower than C. Moreover, in the absence of an accurate way to traverse the heap, these compilers use a GC that resorts to conservative collection (blindly traversing the entire heap looking for pointer-like ints) and the current allocator and collector implementations are extremely slow and never return memory to the OS. The gcc-go compiler is a Go front-end for the GCC compiler that offers optimization but currently has no garbage collection at all.
The use of goroutines and channels is really the defining characteristic of the Go language. This feature stems from previous work by Go's creator, Rob Pike, on the Limbo programming language that was released in 1995. Goroutines are similar to tasks in Cilk or the Microsoft TPL except that tasks return a value whereas goroutines do not. Channels are a mechanism for synchronized communication using message passing.
Go may become an interesting language in the future but, for now, the only available implementations are nowhere near competitive and the language itself is missing many common features (non-null references, generics, exceptions and union types). Our impression is that Google are developing the Go programming language largely for itself, first as a language for high-performance web programming but also potentially as a language for Google's proprietary NaCl Chrome plugin that allows x86 code to be downloaded over the web and executed by a browser.
Comments
Post a Comment