Carbon, the programming language that aims to replace C++

Few days ago a Google employee revealed who is developing a new programming language called "Coal", which is positioned as an experimental replacement for C++, expanding this language and eliminating existing deficiencies.

According to Carruth's presentation, the language was developed to be able to create software where performance is critical. They also wanted to allow developers to take advantage of modern programming language design by using Carbon.

Some of the things highlighted as highlights of Carbon compared to C++ were, for example, simpler syntax and API imports. According to Carruth, this new experimental language should be bidirectionally interoperable with C++, meaning that projects should be able to migrate from one language to another without much difficulty.

In addition, it is a goal to further develop the language in an open way on the Internet, where anyone who wants to can contribute source code. The project is publicly available on Github and is open for pull requests. 

The language supports basic C++ portability, can integrate with existing C++ code, and provides tools to simplify the migration of existing projects by automatically translating C++ libraries into Carbon code.

For example, you can rewrite a certain library in Carbon and use it in an existing C++ project. The Carbon compiler is written using LLVM and Clang builds.

Of the main characteristics of Carbon, the following stand out:

  • The performance of the resulting code is comparable to C++, while maintaining the ability to access low-level addresses and bit-level data.
  • Portability with existing C++ code, including class inheritance and templates.
  • Fast compilation and ability to integrate with existing build systems for C++.
  • Simplify migration between different versions of Carbon.
  • Provides memory-safe tools that protect against vulnerabilities caused by addressing a memory area after it has been freed, dereference null pointers, and buffer overflows.

Of course we have Rust as a proposed alternative to C and C++, but this is not really an extension language, it's more of a full-fledged language, let's start again. Carbon is trying to be like Rust while still being compatible with the world of C++, Well, on its Github page it says:

  • C++ performance matching using LLVM, with low-level access to bits and addresses
  • Interoperate with your existing C++ code, from inheritance to templates
  • Fast, scalable builds that work with your existing C++ build systems

Carbon is claimed to be necessary because incremental improvement of C++ is simply not possible anymore due to the historical baggage that it simply can't get rid of. Personally, I'd go further and suggest that the incremental "improvements" in C++ are part of the reason it's such a large language in practice.

“There are always new languages ​​trying to be successors to C++. I welcome experiments with programming languages ​​and programming styles, but I really don't want to stir up controversy. It's easy to criticize established languages ​​(we know their problems), but it's usually hard to offer alternatives without creating entirely new sets of problems in language rules, libraries, and governance. Carbon is so new and underspecified that I can't really make any meaningful technical comments,” C++ inventor Bjarne Stroustrup said in an email.

While Carbon started as an internal Google project, the development team ultimately wants to reduce contributions from Google, or any other individual company, to less than 50% by the end of the year. Ultimately, they want to hand over the project to an independent software foundation, where its development will be carried out by volunteers.

Finally if you are interested in knowing more about it you should know that the developments of the project are distributed under the Apache 2.0 license and you can consult them In the following link.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.