Google is working on a new language named “Go” and they call it a “systems programming language”. It is not the intent to make a review or to compare it with other existing language, far from that, but it worth having a look at that new language.
First, the syntax is similar to the languages that most of the people are used to. It is more or less the same as C or Java. A bit closer to C anyway for some reason described further in this post. One notable difference is that the type is defined after a variable name, for example.
One of the goal of the language is to simplify the code or to make it less verbose. But, as a tradeoff, it makes the code reading more difficult, or maybe it is just a matter of getting used to the syntax. For example, there is only one keyword for the loops : for
A thing I find nice is the possibility for a function to return more than one value and therefore they introduced multiple return functions.
The other features of the language are summarized here :
Anonymous functions
Slices; a part of an 0-based array
Maps; other word for dictionary
Object orientation using structures; which makes it closer to C than Java and in my opinion not the best thing the language could have
Interfaces
No inheritance; Instead of supporting object inheritance, the creators of the language prefer to use composition of structs
Real-Time flavour; My ADA background reveals to the surface when I see the constructs of Go to support multitasking. What I liked a lot in ADA was the possibility to write methods that were callable from other tasks and how easy it was to create a multi-task program. With Go, it seems that simple. You define a method and rather than calling it normally, you prefix it with the keyword “go” :
go MyParallelTask;
Communication in a multi-task program can also be a challenge, being just to exchange information or data or just to synchronize two tasks. With Go, you need to instantiate a channel and use arrows (channelname <- value and variablename := <- channelname) to send to or received data from the channel. That channel can be synchronous or in other words blocking enabling the synchronization between two tasks or can by asynchronous (under certain limits given by the buffer size of the channel).
On the side of what is not in Go, we have :
Generics or templates
Exceptions
For those two points, the Go team has not yet decided if they would add these features for the reasons that can be read here : http://golang.org/doc/go_lang_faq.html#generics
In conclusion, it is too early to say if this language will succeed and gain many market shares in the programming world. It will mainly depend on the built-in libraries and the platform that will support it. Less important for such system languages is the interoperability features and how a Go program will be able to communicate with the external world. Another success factor is the developer community. Today, Go is only available for Linux or Mac OS X and probably some tools or IDEs would be needed in the future, but not sure because as it is mentioned a number of times, the aim of the language is system programming language and therefore not playing in the same field as C# and other high-level languages.
0 Comments