Carbon (programming language)

Carbon, or Carbon-Lang, is an experimental, general-purpose programming language. The project is open-source and was started by Google, following in the footsteps of previous Google-made programming languages (Go and Dart). Google engineer Chandler Carruth first introduced Carbon at the CppNorth conference in Toronto in July 2022. He stated that Carbon was created to be a C++ successor.[1][2][3] The language is expected to have a 1.0 release in 2024 or 2025.[4]

Carbon
A dark-gray circle with a white sans-serif letter "C" in the middle
Logo on Carbon's GitHub organization
FamilyC
Designed byGoogle
Typing disciplineStatic, nominative, partly inferred
Implementation languageC++
LicenseApache-2.0-with-LLVM-Exception
Filename extensions.carbon
Websitegithub.com/carbon-language
Influenced by
C++, Rust, Go

The language intends to fix several perceived shortcomings of C++[5] but otherwise provides a similar feature set. The main goals of the language are readability and "bi-directional interoperability" (which allows the user to include C++ code in the Carbon file), as opposed to using a new language like Rust, that, while being influenced by C++, is not two-way compatible with C++ programs. Changes to the language will be decided by the Carbon leads.[6][7][8][9]

Carbon's documents, design, implementation, and related tools are hosted on GitHub under the Apache-2.0 license with LLVM Exception.[10]

Example

The following shows how a "Hello, World!" program is written in Carbon:

package Sample api;

fn Main() -> i32 {
    var s: auto = "Hello, World!";
    Print(s);
    return 0;
}

The following is the equivalent "Hello, World!" program written in C++:

#include <iostream>

int main() {
    auto s = "Hello, World!";
    std::cout << s;
    return 0;
}


See also

References

  1. "Scheduled events for Tuesday, July 19, 09:00 - 10:30". CppNorth, The Canadian C++ Conference, July 17-20, 2022. CppNorth. Retrieved 21 July 2022 via Sched.com.
  2. "Carbon Language: An experimental successor to C++ - Chandler Carruth - CppNorth 2022". CppNorth. 22 July 2022 via YouTube.
  3. Bradshaw, Kyle (19 July 2022). "Carbon, a new programming language from Google, aims to be C++ successor". 9to5Google.
  4. Carbon Language: An experimental successor to C++, carbon-language, 12 October 2022, retrieved 12 October 2022
  5. "Difficulties improving C++". carbon-language/carbon-lang repo. Google. 21 July 2022 via GitHub.
  6. Carruth, Chandler; Ross-Perkins, Jon; Riley, Matthew; Hummert, Sidney (23 July 2022). "Evolution and governance". carbon-language/carbon-lang repo. Google via GitHub.
  7. Illidge, Myles (21 July 2022). "Google's Carbon programming language aims to replace C++". MyBroadband.
  8. Jackson, Joab (20 July 2022). "Google Launches Carbon, an Experimental Replacement for C++". The New Stack.
  9. Mustafa, Onsa (20 July 2022). "Carbon, A New Programming Language from Google As A C++ Successor". PhoneWorld.
  10. "carbon-lang/LICENSE". GitHub. 16 June 2020. Retrieved 24 July 2022.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.