Carbon, or Carbon-Lang, is an experimental,
general-purpose programming language
In computer software, a general-purpose programming language (GPL) is a programming language for building software in a wide variety of application domains. Conversely, a domain-specific programming language is used within a specific area. For exam ...
. The project is
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
and was started by
Google
Google LLC () is an American multinational technology company focusing on search engine technology, online advertising, cloud computing, computer software, quantum computing, e-commerce, artificial intelligence, and consumer electronics. ...
, following in the footsteps of previous Google-made programming languages (
Go and
Dart
Dart or DART may refer to:
* Dart, the equipment in the game of darts
Arts, entertainment and media
* Dart (comics), an Image Comics superhero
* Dart, a character from ''G.I. Joe''
* Dart, a ''Thomas & Friends'' railway engine character
* Dar ...
). Google engineer Chandler Carruth first introduced Carbon at the CppNorth conference in
Toronto
Toronto ( ; or ) is the capital city of the Canadian province of Ontario. With a recorded population of 2,794,356 in 2021, it is the most populous city in Canada and the fourth most populous city in North America. The city is the ancho ...
in July 2022. He stated that Carbon was created to be a
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
successor.
The language is expected to have a 1.0 release in 2024 or 2025.
The language intends to fix several perceived shortcomings of C++
but otherwise provides a similar feature set.
The main goals of the language are readability and "bi-directional interoperability", as opposed to using a new language like
Rust
Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO(OH ...
(which, while being influenced by C++, is not two-way compatible with C++ programs). Changes to the language will be decided by the Carbon leads.
Carbon's documents, design, implementation, and related tools are hosted on
GitHub
GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continuous ...
under the
Apache-2.0 license with
LLVM
LLVM is a set of compiler and toolchain technologies that can be used to develop a front end for any programming language and a back end for any instruction set architecture. LLVM is designed around a language-independent intermediate represen ...
Exception.
Example
The following shows how a
"Hello, World!" program
A "Hello, World!" program is generally a computer program that ignores any input and outputs or displays a message similar to "Hello, World!". A small piece of code in most general-purpose programming languages, this program is used to illustra ...
is written in Carbon:
package Sample api;
fn Main() -> i32
The following is the equivalent "Hello, World!" program written in C++:
#include
int main()
See also
*
Comparison of programming languages
Programming languages are used for controlling the behavior of a machine (often a computer). Like natural languages, programming languages follow the rules for syntax and semantics.
There are thousands of programming languages and new ones are c ...
*
Timeline of programming languages
This is a record of notable programming languages, by decade. Prior to 1950 there were 8 unique programming languages, where 6 were unique languages and 2 were combinations of unique languages. By 1960 there were around 45-50 unique programming ...
*
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
*
D
*
Rust
Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO(OH ...
References
External links
Carbon at the Compiler Explorer (godbolt)
Google
Programming languages
Statically typed programming languages
Cross-platform software
Object-oriented programming languages
{{Google-stub