Google announced about new experimental language named "Go". People joke that next will be a debugger named "ogle".
So this language is supposed to replace C and is compiled to machine code, but it includes some features of modern dynamic languages, like garbage collection, lightweight threads (like in Erlang), built-in map type (so missing in Java), cool syntax, type safety, adequate packaging (no more ugly #includes), etc. etc.
Here are some links:
Language spec: http://golang.org/doc/go_spec.html
Effective Go: http://golang.org/doc/effective_go.html
Example of code creating 100 thousands of threads and counting them:
package main
import ("flag"; "fmt")
var ngoroutine = flag.Int("n", 100000, "how many") //command line parameter "n" with default of 100000
func f(left, right chan int) { left <- 1 + <-right } //this function runs on thread, reading int from right and writing incremented int to left channel
func main() {
flag.Parse();
leftmost := make(chan int);
var left, right chan int = nil, leftmost;
for i := 0; i < *ngoroutine; i++ {
left, right = right, make(chan int);
go f(left, right); //this statement starts a new goroutine (light thread)
}
right <- 0; // bang! //write to the last channel
x := <-leftmost; // wait for completion //read from the first channel after it travelled all the chain
fmt.Println(x); // 100000
}
