Google’s (still) experimental language Carbon should one day replace C++

0
25
googles still experimental language carbon should one day replace c.jpg
googles still experimental language carbon should one day replace c.jpg

With Carbon, Google is introducing a potential successor to C++. Unlike Rust, interoperability with existing C++ code is an important goal.

 

With Carbon, Google employee Chandler Carruth has introduced a new, experimental language that is intended to replace C++ in the long term. It is intended to allow “bidirectional interoperability” with existing software in C++ and also make it as easy as possible to migrate C++ code.

 

According to Carruth, it has a different requirement than Rust, with which Carbon otherwise shares many design goals. Carbon could become for the C++ world what Kotlin is for Java, Swift for Objective-C or TypeScript for JavaScript. It should be used above all when large existing C++ libraries have to be integrated and partially simplify migration and the mixing of Carbon and C++ code.

Carbon’s toolchain is said to be able to compile Carbon and C++ code together. However, there are limitations such as #define-Preprocessor macros. Calls from Carbon to C++ and vice versa should not generate any overhead. To do this, Carbon’s memory model is as close as possible to that of C++.

Carbon is an object-oriented language and is designed without a garbage collector. So, like C++, it aims for maximum performance, low-level control, and hardware penetration. In many places, Carbon reduces the complexity of C++. There are pointers, but no pointer arithmetic, and classes do not support multiple inheritance. Type inference is done by that auto-Keyword supported. Memory security is said to be important in Carbon, but not the top priority. The design goals of the language are based on the concept of generic programming and can be found in detail on the project’s GitHub page.

In addition to the actual language design, Carbon also modernizes the ecosystem compared to C++. So it should come with a built-in package manager.

Although the project originated internally at Google, it is intended to develop into a community-driven open source project. There is already a code of conduct and guidelines for contributors. In addition to the GitHub page, discussions about carbon also take place in the Discord channel on language, which currently has over 1000 members.

Chandler Carruth, who presented Carbon to the public for the first time at the Cpp North Convention in Toronto, is a Principal Software Engineer at Google and, as Technical Lead, is responsible for the further development of the most important languages ​​in the group. He represents Google on the C++ Standards Committee and has contributed to the LLVM compiler collection since 2007.

The Carbon roadmap published on GitHub envisages completing the language design and releasing version 0.1 of the language later this year. Version 0.2 is planned for 2023 and should then no longer be experimental. The developers are aiming for version 1.0 for 2024 or 2025. With the Carbon Explorer, there is currently an interpreter as a prototype that can be used to run individual examples.