Carbon: What you should know about Google’s newest language

coding lines

In July of 2022, Google Engineer Chandler Carruth announced the creation of Carbon at the CppNorth conference. The new programming language is aimed at addressing problems with C++, which offers a similar structure and features. 

The Google Carbon team wants the development of what they hope to be one of the new top programming languages to be “an independent and community driven project.” 

The hopeful C++ successor is a general-purpose language that is being designed and built on GitHub, a testament to the experimental and collaborative nature of the project. What can we expect from the Carbon programming language? Here’s a sneak peek at the project and its evolution.

Going Head to Head with C++

C++ remains one of the top programming languages in the world, particularly for software that depends on high performance. But it falls short in several key areas. One major problem software developers are facing with C++ is the mountains of technical debt the language has accrued in its several decades of existence and use.

Already, several newer, cutting-edge languages, such as Go, Kotlin, and Rust, have emerged to offer a superior development experience for programmers. However, it is quite difficult to migrate projects from C++.

The Carbon programming language aims to address these challenges, offering a strong foundation, simple syntax, and modular code organization. It does not intend to alter and improve C++ itself but, rather, operate with C++ and ultimately succeed the more seasoned language. To that end, the newer language offers performance on par with C++. It is also interoperable with the older language, enabling developers to use resources such as C++ libraries, codebases, and ecosystem with Carbon. There is also scalable migration with the older language.

Moreover, if you are familiar with C++, you should have no trouble learning how to use Carbon quickly and easily. Of course, Carbon intends to improve upon C++, much in the way Kotlin has aimed to do the same with Java.

Features of Google Carbon

What does the new Carbon programming language have to offer? Here are the main features and benefits of the language.

• It is ultra fast, offering performance that matches that of C++ when using a low-level virtual machine (LLVM). 

• It’s highly scalable.

• It’s a modern language with a strong foundation.

• It’s easy to learn and use, particularly if you already have experience with C++.

• It’s open-source with a strong, approachable community that is still evolving and growing.

• It includes robust resources — libraries, tools, a compiler, and much more.

• There is migration support when you’re migrating Carbon code from C++ code.

• You can easily upgrade from version to version.

• There are obvious, articulated goals and objectives with regard to the Google programming language. 

And, of course, there’s the fact that Carbon is completely interoperable with C++.

Goals for the Language

The Google Carbon team articulates clear goals for the new programming language on GitHub, stating, “Carbon has an overarching goal of promoting a healthy and vibrant community with an inclusive, welcoming, and pragmatic culture. While this may not directly affect Carbon’s design, it affects how Carbon’s design occurs. We cannot build a good language without a good community.”

Specifically, the team says that the community and project need a code of conduct, “with a deep commitment to psychological safety. We need consistent expectations for how every community member should behave, regardless of their position in the community.” The process for changes, they add, must be open and inclusive, engaging in the direction and evolution of the project.

The Carbon team also has goals for the direction of the language itself. “Programming languages do not succeed in a vacuum,” they note. “The Carbon project cannot merely design a language in order to succeed, it must tackle the full ecosystem of tooling that makes developers effective using the language.”

To that end, they want the Carbon language to have a “broad range” of tools in addition to a compiler and standard library — tools that allow developers to be more productive and efficient in their approach. Carbon will also have a formal specification, the team says, along with approachable documentation and tooling.

Finally, Carbon programming will support:

• Scalable, quick development

• Performance-critical products

• All modern operating systems and environments

• Syntactically readable, writable, and comprehensible code

• Migration from C++ code

• Interoperability with C++ code

• Secure, safe testing procedures

Status of the Carbon Project

The Carbon programming language is still in an experimental phase. However, there is already an active, engaged community surrounding the project. And while there is not yet a functional compiler or toolchain, developers who want to better understand the language can view a demo interpreter for Carbon to get a feel for it. They can also play around with the Carbon code.

Thus far, the Google Carbon team has defined and solidified many of the key features surrounding the new language and associated project. For example, they have articulated a strategy for the project. They have also determined the structure, governance model, and direction, as well as explained the designs for features like generics, class types, inheritance, and more.

Moreover, the syntax is already clearly laid out, aiming to be user-friendly and easy to read, write, and understand. The team behind Carbon wants the project to be collaborative and welcomes feedback and ideas from the C++ community as the newer language evolves.

More resources

At Nearsure, we are excited to see what’s next for the Google Carbon language, and we know the talented software developers and IT specialists we hire are, too. If you’re interested in learning more about one of the newest programming languages on the horizon and staying abreast of the latest news in the sphere, check out these resources. You can even experiment with the code yourself!

Download the source code

Get the compiler Explorer web app

See the full roadmap for the project