NEW TECHNOLOGY GUIDE

Carbon: A New Way to Build Fast Systems.

Google is building a new computer language. It is called Carbon. It is made to replace C++, which is old and hard to use. Carbon is faster to read, safer to write, and works perfectly with your old code.

What is Carbon?

When you build big tools like game engines or web browsers, you need a language that runs very fast. For 40 years, programmers used C++. But C++ has grown too big and messy.

Carbon is an experiment to start fresh. It keeps the speed of C++ but cleans up the mess. It gives developers a simple and modern way to talk to the computer.

// CARBON_FACT_SHEET
  • >>
    Creator Started by Google
  • >>
    Target Use Very large, fast systems
  • >>
    Main Goal Replace C++ cleanly
  • >>
    Status Still an experiment

Why Make a New Language?

THE PROBLEM: C++
  • Too much old baggage. C++ is built on code from 40 years ago. It is hard to add new features without breaking old ones.

  • Hard to read. The rules for writing C++ are very complex. It takes years to learn how to read it well.

  • Not safe by default. It is very easy to write bad code in C++ that makes the whole program crash.

THE SOLUTION: CARBON
  • A clean slate. Carbon starts fresh. It uses modern rules, making it easier to build and update.

  • Simple to read. The code is designed to be read from left to right. It makes sense to human eyes.

  • Built-in safety. Carbon has checks that stop you from making mistakes that cause crashes.

The Magic Trick: Two-Way Sharing

Companies have millions of lines of C++ code. They cannot rewrite everything. Carbon fixes this by sharing perfectly with C++.

OLD C++ CODE
Uses Carbon easily
NEW CARBON CODE
Uses C++ easily
What this means: You can write one new file in Carbon and put it into your old C++ project. It will just work. You do not have to translate anything.

Looking at the Code

See how Carbon makes writing code cleaner and simpler.

Old C++ Way
#include <iostream>

int main() {
  std::cout << "Hello, World!" << std::endl;
  return 0;
}
New Carbon Way
package sample api;

fn Main() -> i32 {
  Print("Hello, World!");
  return 0;
}
1

Clear Names: Carbon uses the word fn to tell you clearly that it is starting a function.

2

Left to Right: You read the name of the function first, and then what it gives back at the end (-> i32).

3

No weird symbols: You do not need to use confusing symbols like << just to print a simple word.

Storing Information: Variables

In every program, you need to save information (like a player's score). Carbon makes the rules for saving information very simple and obvious.

let = PERMANENT

Things That Never Change

If you have a piece of data that should stay exactly the same forever, you use the word let. The computer will stop anyone from accidentally changing it.

let max_score: i32 = 100;
var = CHANGEABLE

Things That Can Update

If the data needs to change (like a timer counting down), you use the word var. This tells the computer to keep the box open for updates.

var current_time: i32 = 60;

Grouping Data Together

Sometimes a single number is not enough. If you are building a game, a "Player" has a name, a score, and health. Carbon uses class to group these together like a folder.

Class: Player
  • var name: String;
  • var score: i32;
  • var health: i32;

Writing Code Once (Generics)

In old C++, if you wanted a list of numbers and a list of words, you had to write the list instructions twice, or use very confusing "templates." Carbon fixes this.

Code: Master List
Written one time.
List of Numbers
List of Words
List of Players

Stopping Crashes Before They Happen

Think of a computer's memory like boxes in a warehouse. In C++, you can try to put items into a box that does not exist. The language will let you do it, and then your program will crash. Hackers use these mistakes to break into systems.

Carbon is designed to be memory safe. It acts like an inspector. If you try to use a box the wrong way, Carbon stops you while you are writing the code. It fixes the biggest cause of bugs in software.

Safety Checks in Carbon

  • Check variables before using? YES
  • Stop numbers from getting too big? YES
  • Prevent using empty memory? YES

Safer Memory Pointers

Sometimes a piece of data is too big to copy. Instead of copying a giant picture, programs just share the "address" of where the picture is. This is called a pointer.

The Old Way (Dangerous)

In C++, if you share an address, the computer does not check if the building is still there. You might arrive at an empty lot, causing the program to crash instantly.

Carbon's Way (Safe)

Carbon puts guardrails on addresses. Before you go to the address, Carbon checks to make sure the data is actually still there. No more arriving at empty lots.

Handling Mistakes Gracefully

What happens if your program tries to read a file, but the file is missing? In older languages, the program might throw a hidden "Exception" that acts like a bomb. If you do not catch the bomb, the whole app dies.

Carbon uses explicit errors:

If a function might fail, it MUST declare it openly.

The programmer using the function is FORCED to write a backup plan.

This means you can look at any Carbon code and instantly see exactly where things might go wrong, just by reading it.

A Better Tool Box

A language is only as good as the tools that help you build with it. Carbon comes with everything included in the box.

Package Manager

Easily download code written by other people and add it to your project with one command.

Code Formatter

Automatically cleans up your typing so everyone's code looks exactly the same.

Smart Compiler

Tells you exactly where your mistake is with clear, easy-to-read error messages.

Auto-Docs

Creates instruction manuals for your code automatically while you type it.

TEST_LAB.CARB
  • Does 2+2=4? Passed.
  • Can player jump? Passed.
  • Is health max 100? Passed.

Testing is Built-In

To write good software, you must test it constantly to make sure you didn't break anything. In C++, setting up tests is a huge headache and requires downloading extra software.

In Carbon, testing is part of the language from day one. You just write your tests next to your code, type one command, and the computer checks all your work for you immediately.

Speed Up The Wait.

C++ programmers spend hours every day just waiting for their code to finish building. Carbon is designed from the ground up to be read and translated by computers incredibly fast. Less waiting, more building.

Faster Build Times = Happier Developers

Who needs Carbon?

Game Developers

Video games need to draw pictures on the screen 60 times every second. Carbon gives them the exact control they need to make games run fast without stuttering.

Web Browsers

Programs like Chrome or Safari use a lot of memory. Carbon helps build browsers that load web pages instantly without crashing your computer.

Cloud Servers

Large companies like Google run millions of computers in the cloud. Carbon helps make these giant systems use less power and run much smoother.

How to Move Your Team

Nobody wants to stop working for a year just to rewrite code. Carbon is built for a step-by-step switch.

1

Learn the Basics

Developers can learn Carbon quickly because it looks very similar to other modern languages they already know.

2

Write Only New Code

Keep all your old C++ code untouched. Whenever you need to build a brand new feature, write that one piece in Carbon.

3

Automated Translation

In the future, tools will be built to automatically scan your old C++ files and translate them into clean Carbon code for you.

Built by Everyone

Even though Google started Carbon, they do not want to control it forever. They have made the entire project open to the public on the internet.

This means programmers from Apple, Microsoft, independent game studios, and universities can all look at the code, suggest changes, and help decide the rules of the language.

View the Public Blueprint
Open
Discussions
Public
Codebase
Global
Community Voting

When can you use it?

Carbon is still a baby. Google is working on it in the open so anyone can help. It is not ready for real work yet.

Phase 1: The Idea

Google decides C++ needs a successor.

Current Phase: Experiment

Testing the rules and building the first tools.

Phase 3: Beta

First real programs can be written.

Phase 4: Version 1.0

Ready for the whole world to use.

Common Questions

Is C++ completely dead now?

No. C++ is still used everywhere and will be around for decades. Carbon is just offering a newer, cleaner bridge for developers building systems today.

Can I use Carbon to build a website?

Carbon is meant for the "backend" — the heavy lifting inside servers, game engines, and operating systems. For normal websites, you will still use languages like JavaScript.

Should I stop learning C++ and learn Carbon?

If you are a student right now, you should still learn C++. Carbon is just an experiment and is not ready for real jobs yet. Knowing C++ will make learning Carbon very easy later.

The Quick Summary

Carbon wants to replace C++.
It shares code with C++ perfectly.
It is much easier to read and write.
It stops memory crashes.
It is open for anyone to build.
It is not ready to use yet.