Carbon, a New Programming Language from Google

In CPP North Event 2022, Google announced Carbon as an experimental successor of C++. From early documentation, they mentioned that the learning curve would be simple for the developers.

carbon programming language by google

If you are a tech-enthusiast and stay on top of the news, you might know that Google launched the Carbon programming language on 19th July 2022. The tech giant has created many frameworks and has introduced languages in the past like Go and Dart. Golang has gained popularity among developers. However, some groups prefer C++ and JavaScript over Dart. The CPP North Event 2022 was just held, and in essence, it is a gathering of numerous developers to talk about the future advancements of C++. Chandler Carruth (Principal Software engineer) introduced this general-purpose programming language.

Table of Contents

What factors led to the development of the Carbon language?

As per Carruth’s explanation, bringing improvements in C++ is difficult. The obstacle to the language’s progress is a bureaucratic committee approach that prioritizes standardization over design. It makes adding new features challenging. Kotlin, Swift, Go, Rust, and many other existing programming languages offer an outstanding development experience.

Developers who are capable of using one of these current languages can keep using those. However, adoption and migration from C++ are severely hindered by the designs of these languages. These aspects led to the development of carbon – an open-source programming language.

Carbon- A successor of C++

Let us know first what is the meaning of the successor language. In line with what Carruth has stated a successor language is defined by the below-mentioned qualities:

  • Must have built on an existing ecosystem without bootstrapping a new one.
  • Provide a bi-directional interoperability
  • Ideally, have tool-assisted migration support
  • Optimize the learning curve and adoption path

Similar to how iOS developers are aware that Swift is the successor for Objective-C, TypeScript considerably improves JavaScript while still being user-friendly. Android developers know very well that Kotlin is the successor to Java. Furthermore, the original C programming language successor is C++, which is extensively used at Google. Some people would argue that Rust, a Mozilla project that has subsequently gained a sizable public following, is a successor for C++. Without a doubt, Rust is a fantastic language to begin a new project. But, it doesn’t have ‘bi-directional interoperability’ and that is why it is challenging to convert a C++ environment to Rust. And now that brings us to the next point: the goals and promises of carbon language.

Goals

Carbon might be the next step in the evolution of software and programming languages. According to Github documentation, as an experimental successor of C++, carbon language will support the below-listed goals.

  • Performance-critical software
  • Software and language evolution
  • Code that is easy to read, understand, and write
  • Practical safety and testing mechanisms
  • Fast and scalable development
  • Modern OS platforms, hardware architectures, and environments
  • Interoperability with and migration from existing C++ code

The main emphasis will be on writing and reading simple code. It will also be a language for swift and scalable development. It will support all the existing operating system platforms. It will also include a strengthened and safe testing framework for complicated codes.

Features of Carbon:

Interoperability With C++

For those developers who are proficient in C++, Carbon would be a simple learning curve. It is composed of a fixed set of grammatical constructions that are meant to sound natural and be simple to read and comprehend.

Picture depicting a C++ test code
C++ code
Picture depicting Carbon, a new programming language by Google's sample code
Carbon code

Generics System

Carbon provides a modern generics system with verified definitions. Yet, opt-in templates are still supported for flawless C++ interoperability.

The generics system delivers C++ templates many benefits, including:

  • Generic definitions are type-checked. This eliminates the need to check the definition for each instantiation at the cost of compile time.
  • Strong, verified interfaces reduce unintentional reliance on implementation specifics and make the relationship with consumers more apparent.

Memory Safety

Carbon strives to handle memory safety, a significant issue troubling C++ developers, by:

  • Improving the tracking of uninitialized states, toughening against initialization errors, and enhancing initialization implementation.
  • Having a standard debug build mode that is more detailed than the build modes offered by C++.

Carbon Programming Language Explorer

Want to give it a try? Carbon Explorer is a prototype interpreter demo that can both execute isolated instances and provide a thorough examination of the particular semantic model and abstract machine of Carbon.

Where can I ask questions and get information about Carbon?

You can use the GitHub Discussions or their Discord and use  #language-questions to pose queries and hold discussions.

Conclusion:

We hope this gives a proper insight into what Carbon is and what this experiment aspires to execute. There is documentation available for developers and tech-savants to resolve every and any queries there may be available. Also, volunteers can contribute to the development process. This new language by Google may take time to be used for real projects, but this open-source technology seems promising to overcome C++ challenges and might change the face of software development.

Featured Web Development

What is SDLC (Software Development Life Cycle)?

SDLC 🔄 is having the best business practice for developing a piece of software. Learn in-depth about SDLC.

Backend Development

Why Node.js is Unarguably Best Choice for Enterprise App Development

Node.js is an open-source and cross-platform JavaScript environment, it runs on the Javascript V8 engine, discusses why enterprises are choosing…

Backend Development

What is Mulesoft? How does it help your business?

Increased usage of APIs has created haywire for professionals and organizations. MuleSoft Anytime supports creating an integration platform. Read more.

Let’s Discuss your Idea.