Carbon programming language

Contents

In July of 2022, an engineer with Google announced the development of a new programming language called Carbon. Will it be a game-changing disruption, or just one more option in a sea of languages?

 

What is Carbon?

The new language was conceived as a replacement, or successor, language for the venerable C++. As such, its syntax has been kept much the same, minimizing any learning curve experienced programmers would face when making the switch.

Of note is the fact that though most of the engineers responsible for developing Carbon before its announcement are employed by Google, it is not a Google project. Rather, it is an open-source experimental successor to C++, and anyone interested can find out more on Github.

 

Why is a replacement for C++ seen as necessary?

While venerable, the fact remains that C++ was developed about 40 years ago as an extension of the even older C. As such, the features added to the language as computers grew in power and speed have made the language—as is the case with so much in the computing world —complex and unwieldy, with plenty of work-arounds. C++ is thus said to have a considerable amount of technical debt, necessitating a lot of extra time from developers forced to use what is still a dominant programming language.

In any case, C++ has its critics and detractors. It’s known to be very difficult to improve a language, so the developers of Carbon have decided to build their language anew. The intent is to make foundational those features now thought important for any programming language—features that were either clumsily added to C++ or simply can’t be added at all. Syntax should be consistent and simple to ensure a gentle learning curve.

 

Aren’t there “replacements” already?

Of course, Carbon is far from the first programming language written with C++-like syntax but modern features: Rust, Kotlin, and Swift come to mind, and there are many more. However, for various reasons these languages present significant barriers that prevent them from being implemented in place of C++. That’s perhaps half of the answer to the question “Why Carbon?” Google wants to be able to start writing software, especially performance-critical software, in Carbon without throwing out everything already written in C++. A minimum of rewriting may still be necessary, but existing codebases and other investments in C++ should be interoperable with assets in Carbon.

It should be noted that the Carbon development team is not casting aspersions on the languages mentioned above. Much has been made of the comment made by the announcing developers that if you are using Rust, by all means keep using it. That is, the developers think that Rust is a perfectly good language for creating entirely new software. It just doesn’t offer the interoperability that they intend with the Carbon language.

 

Comparing Carbon to C++

As of the beginning of September 2022, there isn’t enough Carbon code to do much comparing with anything—there aren’t even any solid language foundations yet. Rather, it’s the intended differences that Carbon’s developers want programmers to pay attention to.

Of course, Carbon will be object-oriented. That was the reason C++ developed out of C in the first place, and anything else would be a step backward in the evolution process.

Also, Carbon will follow its predecessors in being defined as both strongly and statically typed. Strongly typed means that every variable and parameter must be declared and typed, a feature that some simply consider good coding practice. Static typed means that the language checks the types while compiling, not while running. The result is faster runtimes.

Meanwhile, one of the goals for Carbon is increased memory safety over C++. Memory safety is certainly possible in C++—we wouldn’t want it otherwise—but ensuring safety is expected to be much easier to achieve when coding in Carbon.

Finally, the developers will build in a package manager, something that was only added on to C++.

 

Is Carbon something to watch?

For the moment, watching Carbon is all that most of those in the programming world will be doing. Here’s the intended timeline:

  • By the end of 2022: major production release (i.e., version 0.1)
  • Sometime in 2023: version 0.2
  • 2024 or 2025: version 1.0 to be released

 

Part of the intent of the announcement, in fact, was to invite participation in the further open-source development of the language. The developers want contributing to be easy and transparent and will endeavor to keep the governance structure clear.

So, we’ll be watching what changes the project leads approve, to what extent those changes further the project’s goals, and whether the goals themselves are altered as the project matures.

All of that will help determine whether the software business will ultimately feel an impact from the Carbon programming language, and it may not be soon. After all, Rust was released in 2006 and is only now gaining popularity; Kotlin was released in 2012 and has had a somewhat faster uptake, but it is already 10 years old. Both have syntax that is similar to C++, the more so for Rust, and that is a vital feature for any language to eventually supplant an older tool, even an inconvenient one like C++.

 

The takeaway

New programming languages are always under development somewhere, but rarely do they get the attention that having an inside connection to Google can give. Even that, of course, is no guarantee, as the slowish uptake of Flutter and Dart can attest. Then again, Flutter and Dart weren’t created for such a broad purpose nor to be as interoperable as Carbon.

In this case, Carbon’s goals seem to be the right ones at the right time, giving established firms with extensive assets in C++ hope that it will be possible to realize savings without a huge upfront re-coding cost.

So, a self-beneficial response for the world’s developers would seem to be fully embracing it: everyone taking advantage of the open-source project structure to contribute to the Carbon language code or at least to the discussion in some way, allowing for quicker implementation. After all, the old saying that “too many cooks spoil the broth” doesn’t seem to apply to open-source projects.

If you and your team are interested in a deep dive, Carbon’s project team offers a compiler-explorer, aka demonstration installer.

Sign up for the newsletter

Personal data in this form will be processed according to our privacy policy.

You may also find interesting:

How can we help?

Personal data in this form will be processed according to our privacy policy.