The introduction of Google’s Carbon Language Project last week is prompting much discussion in the C++ community, including input from C++ inventor Bjarne Stroustrup.
The project is led by Google software engineer Chandler Carruth – whose keynote at the C++ North conference is now online – and co-led by consultant Kate Gregory and Google’s Richard Smith.
We asked Stroustrup whether he thinks Carbon might be useful.
“There are always new languages trying to be successors to C++. I welcome experiments with programming languages and programming styles, but don’t really want to fuel controversies. It is easy to criticize established languages – we know their problems – but typically hard to provide alternatives without creating whole new sets of problems in language rules, libraries, and governance. Carbon is so new and under-specified that I can’t really make meaningful technical comments,” he said in an email.
Stroustrup chose not to respond to our other question, asking for comment on the flaws in the C++ language evolution process claimed by Carruth and the Carbon team, specifically that it is slow, sometimes indecisive, and primarily focused on standardization rather than language improvement. The Carbon project intends to follow an open source model patterned on Kubernetes.
It is worth noting though that Carruth does not consider Carbon a competitor to C++. He was asked at C++ North how Carbon would compete with future, improved versions of C++ itself, and said, “My goal is not to compete. My goal is to explore things that we can’t do with C++.”
These are early days for the project but a common question is why a brand new programming language is not building in memory safety from the start. “Unfortunately C++ is very unsafe,” said Carruth, asked about this at C++ North. “So we’re starting from a pretty low bar.” Carruth explained that the project is prioritizing migration over safety, but that the intention is to improve memory safety later. “Long term we want at least as much safety as Go or Swift,” he said. Rust is coming from the other end, he said, but may never achieve sufficient interoperability with C++ to enable smooth migration.
Another question is why Carbon is based on interoperability with C++ 17 rather than C++ 20. “At the time, C++20 was still very incomplete in the released compiler we were using. If there is a good motivation, we can consider switching,” Carruth said on GitHub.
Why is it called Carbon? “It’s just a name starting with C. There’s not much more to it than that,” claimed Google’s Jon Ross-Perkins, a Carbon maintainer, on GitHub.