Skip to main content

Carbon, a new programming language from Google, aims to be C++ successor

Carbon, the latest programming language to be built within Google, was unveiled today as an experimental successor to C++.

Over the years, Google has created a few programming languages, some of which have become more popular and prominent than others. For example, Golang (or simply Go) was created for the purpose of improving the development of servers and distributed systems and has since been adopted by the public. Meanwhile, the Dart programming language, originally intended as something of an alternative to JavaScript, didn’t reach mainstream popularity until the release of Flutter.

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.

Android developers well know that Kotlin serves as a successor to Java, just as iOS developers know Swift is the successor to Objective-C. TypeScript, from Microsoft, has thoroughly enhanced JavaScript, while remaining comfortable to use and able to be “transpiled” back to JavaScript. C++, which sees a significant amount of use within Google, is similarly a successor of sorts to the original C programming language.

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.

Top comment by Eric Terry

Liked by 24 people
C++ interoperability is cool, but I doubt it's a big enough advantage to compete with Rust, especially with how many C++/Rust interop projects there are going on. For the projects that absolutely can't be rust, C++20 is pretty robust, I'm not sure that I see enough space between the two to need a full language to bridge the gap. I've been wrong before, but I really just don't see this going anywhere
View all comments

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.

You’re reading 9to5Google — experts who break news about Google and its surrounding ecosystem, day after day. Be sure to check out our homepage for all the latest news, and follow 9to5Google on Twitter, Facebook, and LinkedIn to stay in the loop. Don’t know where to start? Check out our exclusive stories, reviews, how-tos, and subscribe to our YouTube channel

Comments

Author

Avatar for Kyle Bradshaw Kyle Bradshaw

Kyle is an author and researcher for 9to5Google, with special interests in Made by Google products, Fuchsia, and uncovering new features.

Got a tip or want to chat? Twitter or Email. Kyle@9to5mac.com

Manage push notifications

notification icon
We would like to show you notifications for the latest news and updates.
notification icon
You are subscribed to notifications
notification icon
We would like to show you notifications for the latest news and updates.
notification icon
You are subscribed to notifications