== Clone of https://github.com/carbon-language/carbon-lang.git ==

Geoff Romer 6639a915dc Principle: Errors are values (#301) 5 gadi atpakaļ
.github eb85d3dce9 Add back `synchronize` events for deps. (#440) 5 gadi atpakaļ
bazel 7a00f6e15b Add ASan config and enable it in fastbuild. (#437) 5 gadi atpakaļ
diagnostics 9400c1c8ae Switch from manually tracking whether we've emitted any errors to asking the diagnostics machinery. (#406) 5 gadi atpakaļ
docs 6639a915dc Principle: Errors are values (#301) 5 gadi atpakaļ
executable_semantics 27fd9de5bf improved checking for liveness when reading and writing memory (#448) 5 gadi atpakaļ
github_tools b4593f5133 Add pip_install to the build. (#435) 5 gadi atpakaļ
lexer 09763653b7 Add operator precedence parser. (#464) 5 gadi atpakaļ
parser 04a5d6dca7 Avoid performing copies of `ExpectedNode` objects. 5 gadi atpakaļ
proposals 6639a915dc Principle: Errors are values (#301) 5 gadi atpakaļ
scripts 5fbad1089c Add bazel query flag to work around bug (#414) 5 gadi atpakaļ
source 9da9c62225 Port Bazel toolchain and code to macOS (x86). (#238) 5 gadi atpakaļ
third_party acd10c01ef Add submodule entries for brotli and woff2 (#453) 5 gadi atpakaļ
.bazeliskrc 66de1981e4 fix bazeliskrc, change to use latest (#420) 5 gadi atpakaļ
.bazelrc 7a00f6e15b Add ASan config and enable it in fastbuild. (#437) 5 gadi atpakaļ
.clang-format f44cf22924 Add a C++ style guide for the project (#113) 5 gadi atpakaļ
.clang-tidy d4a2d435b8 Enable most relevant clang-tidy checks and fix uncovered issues. (#220) 5 gadi atpakaļ
.codespell_ignore d7143521f6 Merge the ignored words from the toolchain repo. (#209) 5 gadi atpakaļ
.gitallowed cc4211442f Merge carbon-project-tools back into carbon-lang (#203) 5 gadi atpakaļ
.gitignore c7b93c4477 gitignore emacs temp files (#421) 5 gadi atpakaļ
.gitmodules acd10c01ef Add submodule entries for brotli and woff2 (#453) 5 gadi atpakaļ
.pre-commit-config.yaml 7716ac6784 Update pre-commit (#439) 5 gadi atpakaļ
.prettierrc.yaml a768b0ee19 Adjust copyrights based on carbon-project-tools/#3 (#171) 5 gadi atpakaļ
BUILD ef6505a624 Get rid of the website symlink forest (#234) 5 gadi atpakaļ
CODEOWNERS fa984743bf Update CODEOWNERS for the carbon-leads switch (#458) 5 gadi atpakaļ
CODE_OF_CONDUCT.md 0db39f0f00 Add toc to code of conduct (#245) 5 gadi atpakaļ
CONTRIBUTING.md 7a1abddb4f Clarify code review applies to docs in CONTRIBUTING (#262) 5 gadi atpakaļ
LICENSE 7e81d1c213 Fix typo 'langauge'. 5 gadi atpakaļ
README.md 440352af7d Add a link to contributing from README, with ToC for visibility. (#250) 5 gadi atpakaļ
WORKSPACE acd10c01ef Add submodule entries for brotli and woff2 (#453) 5 gadi atpakaļ
bazel-clang-toolchain e440b07eb3 Improve correctness of our Clang tooling infrastructure. (#392) 5 gadi atpakaļ
bazel-execroot e440b07eb3 Improve correctness of our Clang tooling infrastructure. (#392) 5 gadi atpakaļ
compile_flags.txt e440b07eb3 Improve correctness of our Clang tooling infrastructure. (#392) 5 gadi atpakaļ
pyproject.toml a768b0ee19 Adjust copyrights based on carbon-project-tools/#3 (#171) 5 gadi atpakaļ
setup.cfg e440b07eb3 Improve correctness of our Clang tooling infrastructure. (#392) 5 gadi atpakaļ

README.md

Carbon language

Table of contents

Overview

The Carbon Language project is an experiment to explore a possible, distant future for the C++ programming language. It is designed around a specific set of goals, priorities, and use cases:

  1. Performance-critical software
  2. Software and language evolution
  3. Code that is easy to read, understand, and write
  4. Practical safety guarantees and testing mechanisms
  5. Fast and scalable development
  6. Modern OS platforms, hardware architectures, and environments
  7. Interoperability with and migration from existing C++ code

The first six of these represent a set of priorities for C++ shared by a significant subset of the C++ community, industry, and ecosystem. However, C++ is increasingly constrained by a diverse set of concerns and priorities (including some that are irrelevant to or in opposition to these goals, such as ABI stability), and carries a significant historical legacy that makes it challenging to evolve effectively. The result is that these users struggle to meet our goals using C++ today, and that is unlikely to change in the near future. Carbon is an attempt to explore what it would look like to rapidly and systematically re-engineer C++ into a near optimal future state along the top six priorities, which nonetheless is still reachable through interoperability, tooling, automation, and incremental large-scale migration efforts.

For more information, see our goals document.

What about other languages?

Other programming languages don't currently address these needs effectively. They present interoperability, migration, and performance challenges that make it expensive and potentially impossible to migrate a large C++ code base. An approach which requires rewriting an entire binary at once would be infeasible. A large-scale migration must be incremental, meaning that interoperability and tool-assisted code rewrites are critical.

There are projects for several languages to reduce obstacles affecting migration from C++. Some contributors to Carbon are also contributing to those efforts in parallel in order to understand all of the options in this space. TODO: write up a detailed analysis of these languages specifically through the lens of the above goals.

One especially interesting aspect not addressed by the active and widely used languages that might serve this purpose is that they have not been designed specifically to enable migration from and interoperability with today's C++. They don't build on top of C++'s existing ecosystem. There are only a few significant examples of programming languages that center around incremental migration of large existing codebases. They are specifically designed to not require complete rewrites, new programming models, or building an entire new stack/ecosystem. However, there is no comparable option for C++ today:

  • JavaScript → TypeScript
  • Java → Kotlin
  • C++ → ???

Carbon explores what it would look like to fill this gap and align it with the above priorities.

Project status

The project is just getting started. Everything is at a very early stage. If you are hoping to see lots of concrete ideas and plans, you'll probably want to check back in 6 months to a year. At this stage, we're just beginning to lay the foundations.

It is important to understand that this is a science experiment, not a production effort. There are several initial questions that we want to explore and answer with this experiment:

  • Can we deliver a design and implementation that is familiar and compelling to C++ programmers and supports our goals?
  • How seamless and effective can we make interoperability?
  • How easy and scalable can we make migration?
  • Will a significant segment of the ecosystem and industry adopt Carbon given these tradeoffs?

We are committed to learning the answers to these questions, but that may well not result in a production language. There is a very real chance that this project will never leave the experimental phase. Anyone considering contributing or using Carbon should be extremely mindful of that fact: core contributors may abandon the experiment.

While we may sometimes refer to Carbon as a language, it is crucial to understand that the goals of this science experiment are not about new languages, but about how to move today's C++ forward effectively. For example, a near optimal outcome would be to convince the C++ community to adopt this as its official path forward.

What will make Carbon a compelling future path for C++?

We hope that eventually Carbon will provide significant advantages compared to today's C++. Areas where we think we can most dramatically improve C++ for both software systems and developers are:

  • A cohesive and principled language design, even when supporting advanced features.
  • Making common coding patterns safe by default whenever practical, with affordable security mitigations available for any unsafety.
    • We will provide static checks for as many safety issues as we can by default.
    • We will provide a spectrum of build modes with different trade-offs between dynamic safety and performance. For example:
      • The default build mode will include as many dynamic safety checks as we can while keeping the software's performance reasonable for normal development, testing, and debugging.
      • Release builds will favor performance, with opt-in dynamic safety checks and security mitigations for applications with higher security requirements.
    • Over time, we also expect to both track and drive research into increasing the degree of safety available without compromising our other goals.
  • Keeping our core language implementation simple, fast, and easily extended in ways that will make all of our language tools better.
  • Providing an effective, open, and inclusive language evolution process aligned with our goals and priorities.

Carbon will also aim to allow a single layer of a legacy C++ library stack to be migrated to Carbon, without migrating the code above or below. This will make it easier for developers to start using Carbon. Key features underpin Carbon's compatibility and interoperability with C++:

  • The memory, execution, and threading model will be compatible with C++.
  • Access to existing C++ types, interfaces, and even templates will be provided as part of the core language.
  • Carbon will be able to export types, interfaces, and templates for consumption by C++.

However, Carbon's approach still requires a nearly complete re-engineering of the language as well as large-scale migration for users. This is extremely expensive, and so the bar for Carbon to be a compelling direction for C++ is very high.

Contributing

Please see our contributing guidelines for information about Carbon development.