Frustrated by the slow evolution of C++, Google engineers launched a new “experimental” open source programming language, called Carbon, as a possible successor to the venerable but aging C++.
Much like Microsoft built Typescript to update JavaScript, and Kotlin was created to bolster Java’s weaknesses, Carbon could serve as a successor language to C++, which provides an easy jumping-off point for developers into a newer language. which discusses modern development concepts such as memory safety and generics.
Google engineer Chandler Carruth presented the language this week at the RPC North C++ Conference in Toronto.
Advertising
Wither C++
Long the language of choice for building performance-critical applications, C++ is plagued with a number of issues that plague modern developers, Carruth explained on a GitHub page. It has racked up decades of technical debt, bringing with it many deprecated practices that were part of the languages’ predecessor, C. package management, accused Carruth
Language evolution is also hampered by a bureaucratic committee process, geared towards standardization rather than design. Which can make it difficult to add new features. C++ largely has a sequestered development process, in which a select committee makes the important decisions, in a cascading process that can take years.
“The committee structure is designed to ensure representation from nations and businesses, 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 the standard is restricted and costly, attendance is required to have a voice, and decisions are made by live votes of those present. »
Carruth wants to build Carbon through a more open, community-driven environment. The project will be maintained on GitHub, and discussed on Discord.
While Carbon started as an internal Google project, the development team ultimately wants to reduce contributions from Google, or any other 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 led by volunteers.
Live updates from @chandlerc1024East @CppNorth Keynotes 2022! 1/ 🧵 pic.twitter.com/N6ll6esoIH
—Conor Hoekstra (@code_report) July 19, 2022
What’s in the box?
The design wants to release a basic working version (“0.1”) by the end of the year. Carbon will be built on a foundation of modern programming principles, including a generic system, which would eliminate the need to check and recheck code for each instantiation.
Another must-have feature missing in C++ is memory safety. Memory access bugs are one of the biggest culprits of security exploits. Carbon designers will look for ways to better track uninitialized states, design APIs and idioms that support dynamic boundary checks, and create a full default debug build mode. Over time, the designers plan to build a safe carbon subset.
According to the documentation, the language will support:
- Performance Critical Software
- Evolution of software and languages
- Easy to read, understand and write code
- Convenient safety and testing mechanisms
- Rapid and scalable development
- Modern operating system platforms, hardware architectures and environments
- Interoperability and migration from existing C++ code.
The development team will also set out to create an integrated package manager, which C++ is sorely lacking.
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 migrate C++ code to Carbon code.
Why not rust then?
Rouille was another recent language built specifically to address the needs of memory-safe performance applications. So why not just use Rust then? In his presentation at RPC Nord, Carrue advised those who use Rust to keep using it. Carbon is for developers who already have large C++ code bases, which are difficult to convert to Rust. Carbon is specifically what Carruth called a “successor language”, which is built on top of an already existing ecosystem, C++ in this case.
“It’s designed around interoperability with C++ as well as wide-scale adoption and migration for existing C++ codebases and developers,” the documentation explains. This means that the language should perform as well as C++, deliver seamlessly, and offer two-way interoperability with C++.
Google #Carbon the programming language reminds me of the approach Apple took from #ObjC To #Swift. In my experience, this was a very good approach. This made porting Objective-C code to Swift much easier, as you never had to do a full port.https://t.co/dQK5wV0J0B
— Erik Engheim (@erikengheim) July 20, 2022