Table of contents
Carbon is the latest programming language designed by Google engineers. Will it become a worthy successor to C++? What exactly distinguishes Carbon from C++? What should developers know about it? We present a range of useful information about the new programming language created by Google in the article below. Enjoy the read.
Why is Carbon intended to be a C++ alternative?
Currently, the most popular technologies and programming languages are primarily JavaScript, HTML/CSS, Python, and SQL. Will Carbon soon join this group? What makes this programming language stand out? Carbon is an experimental, general-purpose programming language designed by the aforementioned American tech giant. Its first presentation took place in July 2022 in Toronto. Chandler Carruth spoke about the principles of Carbon there – the engineer stated at the time that Carbon is intended to be a successor to the C++ language. The creators of this language set out to fix significant shortcomings present in C++. Furthermore, it offers a very similar set of features. The most important features of Carbon are readability and bidirectional interoperability. All documentation, design, implementation, and a range of Carbon tools are available on GitHub under the Apache-2.0 license.What C++ problems does Carbon plan to solve?
C++ is a programming language that has been developed for many years. Unfortunately, some technologies are already quite outdated – especially those that were implemented in the C language. Additionally, every new feature in C++ must be approved by a special committee. This, in turn, means that introducing subsequent updates takes a long time, which is why changes appear with significant delays. At the same time, the lack of updates often makes this language incompatible with modern technological solutions, and using it can cause developers many difficulties. Carruth’s goal is for Carbon to be widely accessible to all interested parties. Thanks to the collaborative work of developers from around the world, it will be easier to introduce significant modifications – its performance and security level will increase. “The committee structure is intended to ensure representation of countries and companies, rather than creating an inclusive, friendly team and community of experts and people actively contributing to the development of the language. Access to the committee and the standard is limited and expensive, attendance is required for voting, and decisions are made in live votes by those present” – this is how Carbon creator Chandler Carruth wrote about the woes of C++. Previously, it was said that C++ could be replaced by the Rust language created by Mozilla. Although this language has many advantages, it does not offer full bidirectional interoperability, which is why translating code from Rust to other programming languages is difficult or sometimes impossible. An important problem with the C++ language is also memory safety. Memory access errors in code written in C++ can lead to security vulnerabilities. As a result, the project we are working on is highly exposed to attacks from cybercriminals.What does Google plan to do with the project?
Google engineers initially assumed that Carbon would be an internal company project, but these plans quickly changed. Now they plan to reduce Google’s contribution to 50% by the end of 2022. Long-term plans involve handing Carbon over to an independent programming foundation, which is to work on introducing further improvements and updates. The creators’ vision assumes that Carbon will stand out due to the use of modern code design guidelines. It is also intended to have a built-in generic system – this will eliminate the need for double-checking code. Carbon will have a simpler syntax than C++, and user migration to the new language is expected to be fast and efficient. This will be possible thanks to the built-in interoperability feature from C++ to Carbon.How will Carbon differ from C++
Carbon will differ from the C++ language in significant ways. The most important differences between these technologies are:- Carbon is open-source,
- Carbon offers a higher level of security, which reduces the risk of cyberattacks on our projects,
- introducing modifications in Carbon will be much simpler and faster,
- Carbon will use modern code design guidelines, which will facilitate the daily work of developers,
- Carbon uses bidirectional interoperability, which enables the migration of projects from C++ to the new language,
- Carbon has a built-in package manager, which C++ lacks,
- Carbon stands out for its ease of code creation.
