Introducing Carbon, Google’s Experimental Successor for C++

Since its inception, C++ has been the prime choice for building performance-intensive applications. But the language still features some outdated practices caused by its “design by committee”.

On July 19, 2022, during the CPP North C++ conference in Toronto, Google engineer Chandler Carruth introduced Carbon.

4

Find out what Carbon is and how it intends to succeed C++.

What is Carbon?

Google engineers developed theCarbonprogramming language to address the shortcomings of C++.

Many existinglanguages like Golangand Rust already exist that mirror the performance of C++ without its shortcomings. Unfortunately, these languages present significant barriers to the migration of existing C++ codebases.

Dell monitor showing Windows 10 desktop

Carbon aims to bewhat TypeScript is to JavaScript, and Kotlin is to Java. It is not a replacement, but a successor language designed around interoperability with C++. It aims for large-scale adoption and migration for existing codebases and developers.

Key Features of Carbon

Some of Carbon’s key features include C++ interoperability, modern generics, and memory safety.

Interoperability With C++

Carbon aims to provide a gentle learning curve for C++ developers, with a standard, consistent set of language constructs.

For example, take this C++ code:

MacBook and a Dell laptop running ZorinOS next to each other

Translated to Carbon, it becomes:

You can also migrate a single C++ library to Carbon within an application or add new Carbon code on top of existing C++ code. For example:

firefox logo with yellow warning symbol

A Modern Generics System

Carbon provides a modern generics system with checked definitions. But it still supports opt-in templates for seamless C++ interoperability.

This generics system provides a lot of advantages to C++ templates:

A screen displays C++ code

Memory Safety

Carbon seeks to address memory safety, a key issue plaguing C++, by:

Getting Started With Carbon

you’re able to explore Carbon right now by checking out the codebase and using Carbon explorer:

Carbon’s Roadmap Reveals Long-Term Thinking

According to the Carbon roadmap, Google will make the experiment public with the release of a core working version (0.1) by the end of 2022. They plan to follow this with a 0.2 version in 2023 and a full 1.0 release in 2024–2025.

Whether Carbon will be able to reproduce the success of other languages like Golang and Kotlin, remains to be seen.

Should you learn Go? Find out more about job prospects, level of difficulty, and Golang-specific features in this article.

You’ve been quoting these famous films wrong all along!

These are the best free movies I found on Tubi, but there are heaps more for you to search through.

Not all true crime is about hacking, slashing, and gore.

Lose your laptop without this feature, and you’ll wish you had turned it on.

If an AI can roast you, it can also prep you for emergencies.

Technology Explained

PC & Mobile