- Bringing Generic Programming to Google’s Go Language
- Nov 2020
- An international team including NOVA LINCS Software Systems researcher Bernardo Toninho, just published results that will make a big difference on how developers using Google’s Go programming language will make their products more generic, easier and faster to change.
Generics allow developers to write so-called “generic code”. Generic code, after being given missing information about a specific scenario, automatically generates a specialized program to deal with the given scenario. Using this “magic”, it is possible, for instance, to instantaneously generate a new data manipulation app, by providing a description of the structure of data to be manipulated.
Introducing so-called “generics” in Go is a challenge comparable to the introduction of generics in Java back in 2004, but made harder due to Go’s more flexible typing discipline, and fast developer feedback requirements. While Java is currently the most used programming language worldwide, Go is also picking up speed, being strongly promoted by Google.
As the paper introduction starts “Google introduced the Go programming language in 2009. Today it sits at position 12 on the Tiobe Programming Language Index and position 10 on the IEEE Spectrum Programming Language Ranking. Recently, the Go team mooted a design to extend Go with generics and Rob Pike wrote Wadler to ask: Would you be interested in helping us get polymorphism right (and/or figuring out what “right” means) for some future version of Go? This paper is our response to that question.”
The research results have just been published at OOPSLA 2020 and include the correctness proof for the system and a proof of concept implementation (the talk, given by Bernardo is accessible on youtube). An official prototype for generics in Go, drawing heavily from the research collaboration is now available online.