Google unveils new experimental language Carbon

Google Unveils New Experimental Language Carbon

Google has introduced a new experimental language, Carbon, which is supposed to replace C++.

This is not the first programming language created in the bowels of Google. Over the years, Google has developed a number of programming languages, some of which have become more popular. In particular, Golang or Go was created as some kind of C analog with the aim of improving the development of servers and distributed systems and has since become quite common. Also, the programming language Dart has found its application in the development of client applications primarily using the Flutter framework. Nevertheless, the question may arise, why is another C ++ successor language needed, especially when today there are already a number of such languages, for example, Rust?

At the CppNorth conference in Toronto, Canada, dedicated to the C ++ language, Google employee Chandler Carruth shared his vision of the Carbon programming language. First of all, Carruth noticed that many languages ​​have successors in a certain area, for example, Java – Kotlin, Objective-C – Swift, JavaScript – TypeScript, etc. And from the “old” language, you can easily migrate to the “new successor language”. However, in the case of the C++ – Rust pair, this is not the case. While Rust is undoubtedly a great language to start a new project, Carruth says it doesn’t have the same “bi-directional interoperability” as Java and Kotlin, making it difficult to migrate. Accordingly, porting the C++ ecosystem to Rust is difficult.

And the goal of the new Carbon language is to help developers create performance-critical software. However, unlike Rust, Carbon is also designed to be fully compatible with existing C++ code. Also, the goal is to make it as easy as possible to migrate from C++ to Carbon if desired. At the same time, it is emphasized that Carbon is still only an experimental language.

Some features of the Carbon language:

  • Simple grammar
  • Function input parameters are read-only
  • Pointers provide indirect access and modification
  • The package is the root namespace.
  • API import via package name
  • An explicit object parameter declares a method
  • classes do not support multiple inheritances
  • Generic support
  • Explicit implementation by interface types

Comparison with C++. C++ code:

 
The same code on Carbon:

The Carbon language is being developed as open source, all of its code is available in the github repository: https://github.com/carbon-language/carbon-lang

Related Posts


Developer Survey Results on Stackoverflow.com (May 2022)

Stackoverflow.com has published the results of a developer survey conducted in May 2022. In total, ...

Stackoverflow.com has published the result of the May developer survey 2021

On August 2, Stackoverflow.com published the results of the May 2021 Developer Survey. In total, mo...

How to Get Your WordPress Site Featured in Google Answer Boxes

Are you looking for ways to enhance your WordPress site‘s visibility on Google’s organic...

If and Else in single.php: Display Multiple Categories

Want to showcase multiple categories in your single.php file using “if” and “else&...