Google launches Carbon, an experimental replacement for the C++ programming language
Frustrated with the slow evolution of C++, Google engineers launched a new “experimental” open source programming language called Carbon a possible successor to the important but outdated C++.
As explained by Carruth on the GitHub page , C++ has long been the language of choice for building performance-critical applications. C++ has a number of problems that hinder modern developers. It has accumulated decades of technical problems, bringing with it many of the legacy practices that were part of its predecessor language, C. C++ users prioritize backward compatibility to continue supporting widely used projects like Linux and its package management ecosystem, Carruth says.
Language evolution is also hampered by the bureaucratic committee process, which focuses on standardization rather than design which can make it difficult to add new features. C++ has largely a sequestered development process, in which a select committee makes the important decisions, in a waterfall process that can take years.
“The committee structure is designed to ensure representation of nations and companies, rather than building an inclusive and welcoming team and community of experts and people actively contributing to the language,” Carruth wrote. “Access to the committee and standard is restricted and expensive, attendance is necessary to have a voice, and decisions are made by live votes of those present.”
Although Carbon started as an internal Google project, the development team wants to reduce contributions from Google or any other individual company to less than 50% by the end of the year. Ultimately, they want to turn the project over to an independent software foundation, where its development will be managed by volunteers.
The developers plan to release the main working version (“0.1”) by the end of the year. Carbon will be built around modern programming principles, including a common framework that eliminates the need to check and recheck code for each instance.
Another essential feature that C++ lacks is memory safety. Memory access errors are among the biggest security culprits. Carbon developers will look for ways to better track uninitialized states, develop APIs and idioms that support dynamic bounds checks, and create a comprehensive default debug build mode. Eventually, the designers plan to create a safe subset of Carbon.
According to the documentation, Carbon will support:
- Software critical to productivity;
- Evolution of software and language;
- Code that is easy to read, understand and write;
- Practical security and checking mechanisms;
- Fast and scalable development;
- Modern OS platforms, hardware architectures and environments;
- Interoperability with and migration from existing C++ code;
- The development team is also going to build a built-in package manager, something C++ really lacks.
Here is some C++ code translated to Carbon. First, the C++ code:
Here is the same function written in Carbon:
The development team plans to write translation tools to port C++ code to Carbon code.