Frustrated with the slow evolution of C++, Google engineers launched an «experimental» open-source programming language called Carbon, which they see as a possible successor to C++.
Carbon, or Carbon-Lang, is an experimental, general-purpose programming language. The open-source project was started by Google, following in the footsteps of previous Google-made programming languages.
Just as Microsoft created Typescript to update JavaScript and Kotlin was created to address Java’s shortcomings, Carbon can be the successor to C++. This language offers developers an easy transition to a new language that meets modern development concepts, such as memory security and generics (generalization). Last year, Google engineer Chandler Carruth presented the language at the CPP North C++ conference in Toronto.
Carruth explains on GitHub that C++ has long been the language of choice for creating performance-critical applications. Nonetheless, C++ has several problems that hamper modern developers. It has accumulated decades of technical problems, bringing with it many of the inherited practices that were part of its predecessor language, C. C++ users prioritize backward compatibility to continue supporting widely used projects like Linux and its package management ecosystem, says Carruth.
Carbon was announced back in July 2022. But version 1.0 of Carbon will not be available until 2024 or 2025. That is, for now, to deal with C++ is Golang. But the idea is that, in the future, there will be a transition. To convince developers, Google used examples of Microsoft’s well-received TypeScript as an improved alternative to JavaScript. Or the success of Apple’s Swift as an alternative language to Objective C, the one used for years to develop software for the Apple ecosystem.
So, if C were perfected with C++, Google would want to do the same with Carbon. So the question is, why? One argument is that the syntax of C and C++ is too convoluted. This requires a prior learning period. And it generates vast amounts of lines of code that could be reduced with simpler languages. Another argument is that development tools to deal with C++ might be simpler. And although there are solutions like Microsoft Visual Studio, which Microsoft has solved that problem, it is a proprietary tool.
Moreover, language evolution is also hampered by the bureaucratic committee process, which focuses on standardization rather than design, making adding new functions difficult. For example, C++ has largely an isolated development process in which a select committee makes important decisions in a cascade process that can take years. The intended idea for Carbon is to develop a more open and community-led environment.
Another essential feature that C++ lacks is memory security. Memory access errors are among the biggest security culprits. Carbon developers are looking for ways to better track uninitialized states, develop APIs and idioms that support dynamic boundary checks, and create a full default debug build mode. Eventually, designers plan to create a secure subset of Carbon.
Carbon will support the following:
- Software critical to productivity: Carbon will prioritize the development of software that helps increase productivity, whether it’s for individual developers or entire teams.
- Evolution of software and language: Carbon aims to evolve with the changing needs of software development, with an eye towards future-proofing software and keeping pace with emerging trends and technologies.
- Code that is easy to read, understand and write: Carbon aims to be a more accessible language that is easier to read, write, and understand than C++. This will make it more accessible to a broader range of developers.
- Practical security and control mechanisms: Carbon aims to provide developers with practical and effective security and control mechanisms to help them build more secure software.
- Fast and scalable development: Carbon aims to provide developers with tools and features that make it easy to write, test, and deploy code quickly and at scale.
- Modern OS platforms, hardware architectures, and environments: Carbon will be designed to work well on modern operating systems, hardware architectures, and environments, ensuring that it is compatible with the latest tools and technologies.
- Interoperability and migration from existing C++ code: Carbon aims to make it easy to migrate from existing C++ codebases, ensuring that developers can leverage their existing investments and knowledge.
- Built-in package manager: Carbon will feature a built-in package manager, which will simplify the process of installing and managing dependencies, a feature that C++ currently lacks.
Overall, Carbon aims to be a modern, accessible, and practical language that balances performance and ease of use.
To fight C++, Google’s proposal, Carbon, offers compatibility with the current C++ code, simpler code development, and migration without surprises. All this with constant nods to Rust, a programming language that emerged in 2010 with MIT and Apache licenses and is managed by its foundation. To be precise, Rust is the leading alternative in the race to overcome C++. In recent years it has been adopted by companies such as Microsoft, Meta (formerly Facebook), Amazon, and Google itself.
Whether Carbon achieves its goal will depend on many factors. Google’s own or third-party programming language bets have not turned out well. And it’s still in development. So anything we say about this new language is more of a theory than something tangible, as is already happening with Rust. Will Google learn from its past mistakes? What is clear is that it will be the communities of developers who have the last word. So we’ll have to wait for the language rankings for years.