Carbon, the latest programming language to be built within Google, was unveiled today as an experimental successor to C++.
Today, at the Cpp North convention in Toronto, as shared by Conor Hoekstra who was in attendance and documented the slides, Googler Chandler Carruth shared the vision for a new programming language called Carbon. To set the scene, Carruth showed how many of today’s most popular programming languages have successors that allow developers to be rapidly productive and also take advantage of modern language design.
While some may suggest that Rust, originally a Mozilla project that has since grown to have a significant public following, is a successor to C++, Carruth wonders if the analogy still follows. While Rust is undeniably a great language to start a new project in, it doesn’t have the same “bi-directional interoperability” of something like Java & Kotlin, making it difficult to steadily migrate.
If Rust works for you today, you should use it. But moving a C++ ecosystem to Rust is hard.
To that end, while Carbon has many of the same goals as Rust, such as helping developers to create “performance-critical software,” Carbon is also intended to be fully interoperable with existing C++ code. Additionally, the goal is to make migrating from C++ to Carbon as easy as possible, if desired.
As for why a C++ developer may want to consider introducing Carbon to their codebase, Carruth shared quite a few highlights of the language on stage.
- Introducer keywords and a simple grammar
- Function input parameters are readonly values
- Pointers provide indirect access & mutation
- Use expressions to name types
- The package is the root namespace
- Import APIs through their package name
- Explicit object parameter declares a method
- Single inheritance; classes are final by default
- Powerful, definition-checked generics
- Types explicitly implement interfaces
Beyond the features of the language itself, the Carbon team drew attention to the development process that will shape Carbon’s future. The project’s code is hosted publicly on GitHub and is open for pull requests, while Carbon’s culture is outlined to be accessible and inclusive for employees of companies and private individuals, alike.
That said, one aspect of the Carbon programming language that’s not particularly well outlined is Google’s involvement. While today’s presentation was shared by a Googler, and the current project leads for Carbon consist primarily — but not entirely — of Googlers, there’s otherwise no mention of Carbon being a Google project.
This is actually intentional, as while Carbon got its start within Google, the team understands and has shared online that for it to have any future success, Carbon needs to be “an independent and community driven project,” not solely driven by Google’s own uses. In the same comment, Carruth further emphasizes that Carbon is currently just an experiment, albeit one that some companies have already shown early interest in.
If you’re interested in getting started with Carbon, you can download the source code and experiment with it on your own device. Or, you can get a feel for the Carbon programming language directly in your browser thanks to integration with the free Compiler Explorer web app.
An earlier version of this article incorrectly stated that all of Carbon’s leads are Google employees. We apologize for the mistake.
FTC: We use income earning auto affiliate links. More.