
Google has invented a new programming language called
Go. Behind this new language are Pobert Griesemer, Rob Pike, Ken Thompson - the creator of UNIX operating system.
Go is classified as a system programming language like C and C++. Google uses a lot of C++ and Python and Go can provisionally replace them because:
- Go is fast - the compiled Go programs run nearly as quickly as C/C++. System programming languages are used to write low level stuff like the OS kernels, device drivers, servers etc where performance is crucial.
- Go compiler is fast - one of the advantage of script languages like Python is a very fast development cycle. Though Go is a compiled language, its compiler returns almost instantly which makes it a good substitution of scripting languages.
- Go is safe - Being a static type language without pointer arithmetic, you would not make silly bugs like out of bound error. Go also has automatic garbage-collection. So it is both type-safe and memory-safe.
- Built-In support of concurrency - With a feature called 'goroutines', Go allows developers to take advantages of the multi-core systems nowadays.
- Go is object-oriented - Most people believe that OOP is a must in programming-in-large.
So what make Go really special ?
Benefits of static-typed-compiled and dynamic languages - You get the development productivity of dynamic scripting languages like Python and Ruby yet you can get static typed compiled programs which are safe and efficient.
The language is designed to key things simple - orthogonal concepts instead overlapped ones, context free grammar, reduced typing, no type hierarchy, explicit module dependencies and explicit type conversion - all these features simply the language.
Commonly used concepts are natively supported - Strings, maps, communication channels, concurrency are built-in constructs - why involve libraries when the concepts are used all the time. Being native constructs, they can be optimized in code generation.
Separation of Types, Methods and Interfaces - Methods in Go are merely a special form of functions (taking an additional argument of the type it applied to). An interface is merely a list of methods to be implemented by a type in order to support the interface. In fact, you don't need to specify that a type supports a particular interface. If a type 'implements' all the methods required in the interface, it automatically supports the interface.
If two interfaces have a shared set of methods to be implemented, a type that supports both interfaces need only one implementation of the overlapped method (rather than duplication under the implementation of two interfaces).
So why a new language, rather than improving existing ones ?
The existing languages were not designed with the following in-mind:
- Bloated libraries
- Networking
- Client/server
- massive clusters
- multi-core CPUs
As mentioned by Rob Pike, clumsy type systems drive people to dynamically typed languages. The problem is both endemic and linguistic. You cannot just add things to existing languages to resolve the problem. So they start to design a new language.
The status of Go
The language core itself is quite stable but it takes time to build more comprehensive libraries and ecosystem around the language. The compilers need improvement as well. Programming construct like generics is also not yet supported (but maybe in the future).
Some people thought that creating a new programming language like Go is not justified because it doesn't bring anything new. I would say that they simply missed the point (I wonder whether they have viewed the whole
TechTalk presentation at all) mentioned by Rob Pike - "it wasn't enough to just add features to existing programming languages, because sometimes you can get more in the long run by taking things away. "
The value of a programming language is not measured by no. of features (or new features) it has but the choices of features to be included and how they are put together. Efficiencies in development, execution and maintenance are the key factors to measure the usefulness of a programming language - It is all about efficiency !!
After all, a programming language is for programmers, not for those blog editors.
The key point of the Go programming language is to get things done fast and fun. What else do we need ?
References