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.

About Jinesh Shah

ultroNeous Technologies Is a Renowned Software Development Company having offices In USA, India & Canada. Our Expert Team of Designers & Developers Help Your Business Drive Revenue & Growth.

ReactJS Development

Why Do Companies Choose React over Angular?

React is a popular JavaScript library chosen by companies for web development projects. Its lightweight design, ease of use, and…

IT staff Augmentation

IT Staff Augmentation vs. Project based Consulting: What’s the Difference?

This article will help you to decide if staff augmentation or project-based consulting is better for your business. Read more…

Web Development

Introduction to new NodeJS 19: Latest updates and features

What's new in Node.js 19? Features like Watch, keep-alive. Read more to find out.

Let’s Discuss your Idea.