Google has launched Go, a new systems programming language born with concurrency, simplicity, and performance in mind.
Go is open source and its syntax is similar to C, C++ and Python. It uses an expressive language with pointer but no pointer arithmetic. It is type safe and memory safe. However, one of its main goals is to offer the speed and safety of a static language but with the advantages offered by modern dynamic languages. Go also offers methods for any type, closures and run-time reflection. The syntax is pretty clean and it is garbage collected. It is intended to compete with C and C++ as a systems programming language.
What about multicore programming with Go? It promotes lightweight concurrency allowing developers to create sets of lightweight communicating processes. Go calls them goroutines. This way, you can run many concurrent goroutines and you don't need to worry about stack overflows. Go promotes sharing memory by communicating. Goroutines aren't threads, they are functions running in parallel with other goroutines in the same address space. It is very easy to launch parallel functions using the goroutines. This is one of the most interesting features offered by the language. It really simplifies concurrency for systems programming.
Go's key features related to concurrency are:
- Channels of channels.
- Leaky buffers.
- Share by communicating approach.
These features deserve new posts explaining them with more detail. Stay tuned because I'll be adding new posts about Go soon.
The idea behind Go is to offer a fast compiler to produce fast code. So far, it offers two compilers:
- Gccgo (GCC is in the back).
- 8g (x86-32) and 6g (x86-64).
If you want to test this new programming language, your starting point is Go's main page.