Google’s Carbon programming language aims to replace C++
Google unveiled a new programming language called Carbon on Tuesday, 19 July 2022, which it said is an experimental replacement for C++.
9to5Google reported that Google principal software engineer Chandler Carruth announced Carbon during the Cpp North convention in Toronto.
Carruth said that although many may suggest that Rust is a successor to C++, it lacks the level of “bi-directional interoperability” that Carbon offers.
He said Carbon is intended to be fully interoperable with existing C++ code, adding that the goal is to make the transition from C++ to Carbon as easy as possible.
“If Rust works for you today, you should use it. But moving a C++ ecosystem to Rust is hard,” said Carruth.
Conor Hoekstra, a convention attendee, posted Carruth’s slides on Twitter.
Highlights of Google’s new programming language include:
- Introducer words and a simple grammar
- Function input parameters are read-only values
- Pointers provide indirect access and 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
Interestingly, Google noted that for the language to be successful, Carbon must be “an independent community driven project” and not solely for Google’s use.
Therefore, while most of Carbon’s current leads are Google developers, there is no explicit information classifying it as a Google project.
The source code for Carbon is available on GitHub and is open to pull requests.