Listen to this story
During the recently held ‘CPP North’ conference in Toronto, Chandler Carruth, a software engineer at Google, introduced developers to a new programming language called Carbon. According to Carruth, Carbon is an experimental successor to C++, which is ageing, and there is a growing demand in the developer community for the programming languages to evolve.
Sign up for your weekly dose of what's up in emerging technology.
Can Carbon be a worthy successor?
At the event, Carruth announced Carbon as an experimental successor to the C++ programming language. Even though most of the developers working on Carbon are from Google, it is not a Google-exclusive project. Carruth revealed they would soon start this experimental work with the C++ community.
Carbon is open source, and the developers want it to be ‘an independent and community-driven project’ for it to be successful. So the project will be maintained on GitHub, with discussions on Discord.
“Carbon is for organisations and projects heavily dependent on C++; for example, projects that have a lot of C++ code or use many third-party C++ libraries,” the creators said in a Github repository.
The origin of Carbon also lies in the fact that it is difficult to improve C++. One of the primary reasons for this is that C++ has decades of technical debt accumulated in language design. Further, it also inherited the legacy of C.
Carbon does not inherit the legacies of either C or C++. Instead, the developers have ensured Carbon has a much more efficient evolution process. Also, it’s built on open-source principles, processes, and tools.
However, for Carbon to be a worthy successor to C++, there is a long way to go. First of all, C++ has been around for a very long time. Carbon, on the other hand, is still in the experimental stage and years away from actual use. Even when it comes to life, Carbon must be able to address the problems that C++ failed to.
One of the plus points of C++ is that it can directly manipulate the hardware it runs on. All programmers need to do is fine-tune their code even in limited hardware space availability. For Carbon to be a successor, it must also be able to do similar things, and maybe more.
Also, the use cases of C++ are multifold. Popular operating systems such as Windows and macOS use C++. It is also one of the widely-used programming languages in the gaming industry, with games such as World of Warcraft, and Counter-Strike having been developed using C++.
Popular database tools like MySQL and MongoDB were built using C++. It also plays a role in web browsers like Google Chrome, Mozilla Firefox, and Safari. TensorFlow, an open-source software library for machine learning, also relies on C++ as a back-end programming language. Further, C++ is also used to develop many financial tools and flight softwares.
Carbon in, Rust out!
Before Carruth introduced us to Carbon, another programming language called Rust was seen as the successor to C++. This was primarily because of its syntactic similarities to C++, as it provides increased speed and better memory safety. However, this is open to discussion since many developers found Rust too difficult to learn as it introduced a lot of novel concepts too.
Besides the steep learning curve, converting major projects’ current C++ codebases to Rust is challenging. Further, according to the developers of Carbon, the design of Rust itself acts as a significant barrier to adoption and migration from C++. On the other hand, Carbon aims to convert the C++ codebases in a much better way than Rust.
For a C++ developer, it won’t be difficult to learn Carbon. In fact, Carbon is said to have a gentle learning curve. While many felt using Rust was similar to learning a new programming language.
“It is built out of a consistent set of language constructs that should feel familiar and be easy to read and understand,” Carbon’s Github page states.
While speaking at the event, Carruth also explained that Rust, which Mozilla developed, doesn’t have the same ‘bi-directional interoperability’ as other tools. But, the creators of Carbon encourage developers to keep using Rust if it’s technically and economically viable for the project.
“We believe Rust is an excellent choice for writing software within the pure Rust ecosystem. Software written in Rust has properties that neither C++ nor Carbon has. Rust is also good for using APIs implemented in a different language in-process, when the cost of maintaining the FFI boundary is reasonable.”
How is the industry reacting?
“Carbon matches 100% of the performance of C++ and aims to provide a significantly better developer experience,” Kaggle master and senior data scientist Mark Tenenholtz tweeted.
This is mainly because Carbon reduces existing libraries’ tech debt and makes extending those libraries easier.
However, not everyone is convinced that Carbon would be a worthy successor to C++. While Carbon is new, C++ has been around for decades and has large community support.
“I don’t know if Carbon will be ditched in a year or if it’s going to revolutionise the way C codebases are maintained,” Tenenholtz added.
A few community members questioned the need to change trivialities like syntax and make people learn stuff all over again.
However, another section of developers are excited about Carbon and what it could bring to the developer’s community.