Google Open Sources Alternative C++ Programming Language: Carbon

Google engineer Chandler Carruth announced at the CppNorth conference held in Toronto recently that he officially open sourced the programming language built by Google: Carbon, and said that Carbon is the successor of C++ (currently in the experimental stage).

Chandler cites some examples of the evolution of popular programming languages ​​today, such as: Java to Kotlin, Objective-C to Swift, JavaScript to TypeScript. C++, which is widely used within Google, is also regarded to some extent as the successor of the C language. He believes that these successors can help developers quickly become more productive and take advantage of modern language features.

Chandler also mentioned Rust, which was also initially touted as the successor to C++, but the relationship between the two is not as "two-way interoperable" as Java and Kotlin, making it difficult to migrate steadily. As for  Carbon, it shares many of the same goals as Rust and supports full interoperability with existing C++ code, with the goal of making it as easy as possible for developers to migrate from C++ to Carbon.

Carbon Highlights:

  • Introducer keywords and simple syntax
  • Function input parameters are read-only values
  • Pointers provide indirection and variants
  • Use expressions to name types
  • Packages are in the root namespace
  • Import API by package name
  • Method declaration with explicit object parameters
  • Single inheritance, final class by default
  • Powerful and Definition-Checked Generics
  • Types can explicitly implement interfaces

Comparison of C++ code and Carbon code:

At present, the code of Carbon language is completely open source . Chandler said that while Carbon was born within Google, and its current project leaders are made up of mostly (not entirely) Google employees, it aims to be an "independent and community-driven open source project."

If you're interested in Carbon, you can download the source code and experiment on your own device, or   experience the Carbon programming language directly in your browser through the Compiler Explorer .


For the Carbon project, some developers have revealed some background information: In February 2020, the C++ Standards Committee voted on the "Break ABI Compatibility to Guarantee Performance" proposal. This work was mainly promoted by Google employees, but the final vote was not passed. . As a result, many Google employees have stopped participating in C++ standardization efforts and resigned from their formal positions on committees, and clang development has slowed considerably. Based on these backgrounds, combined with Google's goals for Carbon, the developer believes that Google really wants to make Carbon an alternative to C++.

Guess you like

Origin www.oschina.net/news/203540/carbon-programming-language-google-cpp