Commit Graph
377 Commits
Author SHA1 Message Date
josh11b dc394b6d95 Clarify some points in Member Access design (#3177)
Follow-on to #3160. Incorporates decision about template specialization
from #2200.
2023-09-06 22:23:52 +00:00
josh11bandRichard Smith d5d6945f85 Update member_access.md to reflect accepted proposals (#3160)
Most changes are due to proposal #2360, but this also includes changes
to reflect: #1136, #2138, #2006, #2550, and #2964.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-08-31 00:17:00 +00:00
josh11b 9600030a05 Reduce ambiguity in terminology (#3162)
Change terminology away from terms that are ambiguous:

- Reserve "generic type" for types with (compile-time) parameters, like
`Vector` in `Vector(T:! type)`. Don't use that term to refer to `T`, as
it would with
[#2360](https://github.com/carbon-language/carbon-lang/blob/trunk/proposals/p2360.md#terminology).
- Use the term "compile-time" instead of "constant" to mean "template or
symbolic." Expand the term "constant" to include values, such as from
`let` bindings.
2023-08-30 17:13:40 +00:00
Richard Smith 84ea453161 Add semicolon to description of return var; statement. (#3131)
The semicolon is part of the statement's syntax, and including it will
hopefully help clarify that we're not using `var` as a placeholder and
talking about `return` _variablename_ `;`.
2023-08-22 19:11:14 +00:00
Lucile Rose NihlenandChandler Carruth fe93c0225f add documentation about debugging on macOS (#3114)
Adds some notes about the required build flags for lldb to successfully
find the symbols on macOS debug builds. Also adds a recommended debugger
configuration for interactive debugging in VSCode on macOS.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2023-08-18 19:01:50 +00:00
josh11bandRichard Smith e15bdbb36c Update generics overview (#3061)
This reflects changes from a number of approved proposals:

- #2138 : "generic" -> "checked generic", "template" -> "template
generic"
- #2360 : "type", "facet type", "facet". Note: I am not using the term
"generic type" from #2360 since that meaning conflicts with the
generally accepted meaning of "generic type" of a type with a
compile-time parameter.
- #2760 / #2770 : internal/external impl -> extending impl
- #2964 : "symbolic constant" and "template constant"

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-08-15 19:58:23 +00:00
Richard Smith 90cca11ea3 Document the de facto conventions for library dependencies in explorer (#3092)
Unlike in the toolchain, we have not been preferring LLVM facilities
over standard ones. Update the documentation to describe this and
provide some rationale.
2023-08-11 19:22:58 +00:00
Richard Smith 7b22173cba Add precedence rules for assignment operators to the precedence diagram. (#3083)
Also indicate what can appear within parentheses.

This is intended to be a clarification, not a design change. Note that
while we previously described the operand of `++` or `--` as being
simply an expression, the operand can never be anything other than the
kinds of expression the diagram now shows due to the expression category
rules added in #2006.

Fixes #3079.
2023-08-10 22:35:51 +00:00
Chandler Carruth 6d3a4b84cb Mark unary operators as repeating. (#3074)
Currently, they are marked as left-associative which isn't completely
obvious for unary operators and wouldn't match the fact that we have
both prefix and postfix unary operators we intend to allow to repeat
without parentheses: `***x` and `T***`.

This fixes the graph by making the left-associative marker only for
binary operators, and using a separate marker for repeating unary
operators: a diamond.

It also adds a note that Carbon currently only has left-associativity
because the right-associative operators like assignment are statements
in Carbon.

This isn't intended ta be a change of anything in Carbon's design, just
an improvement to the documentation.
2023-08-08 17:57:25 +00:00
0d1e6bd84d Values, variables, pointers, and references (#2006)
Introduce a concrete design for how Carbon values, objects, storage,
variables,
and pointers will work. This includes fleshing out the design for:

- The expression categories used in Carbon to represent values and
objects,
how they interact, and terminology that anchors on their expression
nature.
-   An expression category model for readonly, abstract values that can
    efficiently support function inputs.
- A customization system for value expression representations,
especially as
    seen on function boundaries in the calling convention.
- An expression category model for references instead of a type system
model.
-   How patterns match different expression categories.
-   How initialization works in conjunction with function returns.
- Specific pointer syntax, semantics, and library customization
mechanisms.
- A `const` type qualifier for use when the value expression category
system
    is too abstracted from the underlying objects in storage.

---------

Co-authored-by: Geoff Romer <gromer@google.com>
Co-authored-by: josh11b <josh11b@users.noreply.github.com>
Co-authored-by: Adrien Leravat <Pixep@users.noreply.github.com>
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-08-08 07:27:44 +00:00
josh11b 916bb4022a Update generics goals doc (#3060)
This reflects changes from #2138 , plus a number of other updates,
including reflecting that we have decided to include templates in
Carbon.
2023-08-05 05:39:34 +00:00
587ab64d1b Update Generics terminology document (#3048)
This reflects changes from a number of approved proposals:
- #920 : concrete statements about orphan and overlap in Carbon
- #2138 : "generic" -> "checked generic", "template" -> "template
generic"
- #2188 : binding patterns are forbidden in type position
- #2360 : "type", "facet type", "facet". Note: I am not using the term
"generic type" from #2360 since that meaning conflicts with the
generally accepted meaning of "generic type" of a type with a
compile-time parameter.
- #2760 / #2770 : internal/external impl -> extending impl
- #2964 : "symbolic constant" and "template constant"

---------

Co-authored-by: Geoff Romer <gromer@google.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-08-02 23:22:15 +00:00
Samiur KhanandJon Ross-Perkins 45ca5bb2c4 Update contribution tools with bazel versioning details (#3053)
You need bazel version 6.0.0 (with --host_per_file_copt) to build
carbon. This adds versioning info and adds that Linux, Mac and Windows
can use bazelisk.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2023-08-02 22:14:23 +00:00
mx42andjosh11b 1cab6920f2 Treesitter parser (#2902)
A push towards better editor support.
See utils/treesitter/README.md

---------

Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2023-07-13 18:28:28 +00:00
ea982ad2c8 Simplified package declaration for the Main package (#2550)
Make the preamble of simple programs more ergonomic, by removing the
`package Main` from the main package and removing the `package`
declaration
entirely from the main source file. Imports within a single package no
longer
need to, and are not permitted to, specify the package name.

Partially covers #2001 / #1136.
Covers #1869.
Supersedes #2265.
Addresses design idea #2323.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2023-07-06 21:55:54 +00:00
Adrien Leravatandjonmeow a914932b1c doc: update PR workflow for GH merge queues (#2965)
Co-authored-by: jonmeow <jperkins@google.com>
2023-07-06 18:33:58 +00:00
T.J. Givenandjonmeow c974a77314 Added newline example and clarifications for string_literals.md (#2966)
Updated string_literals.md to mitigate confusion around newline behavior
in the context of block string literals.

Addresses #2887

---------

Co-authored-by: jonmeow <jperkins@google.com>
2023-07-06 18:33:49 +00:00
Jon Ross-Perkins 9c74c5dba4 Narrow example addr pattern to self. (#2970)
Although discussed for other situations, `self` is the only concrete
use-case of `addr`.
2023-07-06 18:30:30 +00:00
Manmeet Singh 1646ba1182 update keywords in textmate syntax (#2953)
keywords were taken from docs/design/lexical_conventions/words.md
2023-06-28 15:24:04 -07:00
e8f0866b2f Introduce a new Conduct team (#2922)
The Carbon Project relied on the three leads to handle conduct concerns initially as it bootstrapped its community team and expertise. We now have an active and effective community lead and team of moderators. Our community lead has worked to train and ramp up a new and independent conduct team.

This proposal both provides an overview of the process and hands off conduct handling to the new team! Going forward, we expect routine updates to the conduct team to happen without full proposals as they allow trained folks to rotate in and out of this difficult but essential role on the project.

Last but not least, making these changes uncovered a restriction in the Code of
Conduct itself that we expect to be problematic to adhere to going forward.
While well intentioned, it has a bunch of unanticipated effects that made both
current and new conduct teams want to remove it. A related section has had its
wording strengthened to try and address the underlying motivation at least
partially.

Most of this content comes from @CelineausBerlin with some additions and edits from myself and the other leads as we worked toward building the new CoC team.

Co-authored-by: Céline Dedaj <CelineausBerlin@users.noreply.github.com>
Co-authored-by: Geoff Romer <gromer@google.com>
Co-authored-by: Kate Gregory <kate@Gregcons.com>
2023-06-27 15:35:35 -07:00
Jon Ross-Perkins 2e7ce09c34 Explicit 'one or more' for digits in non-decimal integers. (#2936) 2023-06-22 15:55:10 -07:00
josh11b 2ae8117d62 Update design docs with syntax changes from #2760 (#2866)
This includes:

- Syntax changes from this chart:

| Before                          | After                                   |
| ------------------------------- | --------------------------------------- |
| `class D extends B { ... }`     | `class D { extend base: B; ... }`       |
| `external impl C as Sub;`       | `impl C as Sub;`                        |
| `class C { impl as Sortable; }` | `class C { extend impl as Sortable; }`  |
| `adapter A for C { ... }`       | `class A { adapt C; ... }`              |
| `adapter A extends C { ... }`   | `class A { extend adapt C; ... }`       |
| `interface I { impl as J; }`    | `interface I { require Self impls J; }` |
| `interface I { extends J; }`    | `interface I { extend J; }`             |

- Dropping the syntax for conditionally implemented internal interfaces.

This does not include:

- terminology changes from #2760 ("internal" and "external")
- changes to code, such as explorer, toolchain, language grammars, or other tooling
2023-06-16 14:22:29 -07:00
josh11bandRichard Smith 6f8cf38329 Consistent class and interface syntax (#2760)
Update syntax of `class` and `interface` definitions to be more consistent. Constructs that add names to the class or interface from another definition are always prefixed by the `extend` keyword.

Implements the decisions in:

-   [#995: Generics external impl versus extends](https://github.com/carbon-language/carbon-lang/issues/995),
-   [#1159: adaptor versus adapter may be harder to spell than we'd like](https://github.com/carbon-language/carbon-lang/issues/1159),
-   [#2580: How should Carbon handle conditionally implemented internal interfaces](https://github.com/carbon-language/carbon-lang/issues/2580), and
-   [#2770: Terminology for internal and external implementations](https://github.com/carbon-language/carbon-lang/issues/2770).

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-06-14 17:18:54 -07:00
Richard Smith 2cf5ab155b Fix copy-paste error in name of pull request (#2871)
From a suggested change from jonmeow that arrived after #2870 was merged.
2023-06-02 16:14:59 -07:00
josh11b f0ead22f0c Allow overlap with a final impl if identical (#2868)
Allow an `impl` to overlap with a `final impl` if they agree on the overlap. Agreement is defined as all values comparing equal, and functions never comparing equal.  Implements the decision in question-for-leads issue #1077.
2023-06-02 16:05:46 -07:00
josh11b 684168fbef Follow-up to #2657: include #2511, references (#2870)
With this change `docs/design/lexical_conventions/symbolic_tokens.md` should now include all operators and symbols from accepted proposals.
2023-06-02 16:03:21 -07:00
Aswin ShailajanandAvi Aaron 6d399c80b0 Added info on symbolic tokens in design docs (#2657)
The [Operators proposal #601](https://github.com/carbon-language/carbon-lang/pull/601) got accepted and but the details were not updated in the design docs. Added `symbolic_tokens.md` file to add the details of the proposal and its discussion.

Closes #1992 

Co-authored-by: Avi Aaron <81820388+aviRon012@users.noreply.github.com>
2023-06-01 22:16:13 -07:00
Geoff RomerandRichard Smith b59b3fbff7 Document pattern syntax and semantics (#2853)
Integrates the content of #2188 into `pattern_matching.md`

Closes #2852 

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-06-01 17:39:11 -07:00
Richard Smith b235b53e95 Break long ground rule bullet into multiple bullets (#2805)
This makes the bullets more self-consistent and easier to read, and makes this list match the list in the code of conduct.
2023-04-26 16:42:46 -07:00
debe4cc151 Defining the 0.1 language (#2759)
Provide a clear definition of our goals for the 0.1 Carbon language, and a
concrete feature-set that is expected to satisfy these goals.

The high level goal proposed for the 0.1 language is to reach an evaluation-MVP
(Minimal Viable Product): it should be sufficiently complete to evaluate its
suitability specifically with respect to fitness as a C++ successor language.

The features proposed for 0.1 language in turn focus on C++ interoperability and
a minimal subset of foundational aspects of the language.

Beyond the language itself, the other project features and milestones proposed
focus on enabling evaluation of the language design and interoperating with C++
in practice.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: jonmeow <jperkins@google.com>
Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2023-04-25 18:19:06 -07:00
Adrien Leravat 65578bd8db Documentation: fix typo (#2742) 2023-04-05 16:17:03 -07:00
Aswin Shailajan b956d0603f Updated words.md with info on NFC (#2681) 2023-04-03 11:17:48 -07:00
Aswin Shailajan 33f26bd37b Added design of comments in design docs (#2641)
The [Comments #198](https://github.com/carbon-language/carbon-lang/pull/198) got accepted but the details were not updated in the design docs. Added `comments.md` file to add the details of the proposal and its discussion.

Closes #1994
2023-03-30 09:51:47 -07:00
Adrien Leravat 2c59dbc5fe doc: replace references to #821 by #2006 (#2724)
Replaces references to PR #821 (closed) by #2006 (draft) which tracks the same feature definition.
2023-03-30 09:43:46 -07:00
642fcd3b77 Replace keyword is with impls (#2483)
Use the keyword `impls` instead of `is` when writing a `where` constraint that a type variable needs to implement an interface or named constraint.

What was previously (provisionally) written:
```
fn Sort[T:! Container where .ElementType is Ordered](x: T*);
```
will now be written:
```
fn Sort[T:! Container where .ElementType impls Ordered](x: T*);
```

---------

Co-authored-by: Geoff Romer <gromer@google.com>
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2023-03-22 21:45:32 -07:00
Geoff Romer b795cc6f51 Clarify semantics of let bindings (#2690)
This tries to make it clearer that user code is responsible for ignoring observable differences between the possible behaviors, and uses "alias" instead of "pointer" to describe the reference-like option. It also avoids taking a stance on how we address the possibility of the original value being mutated after it is aliased.
2023-03-17 13:00:46 -07:00
Jon Ross-Perkins 9a063ccdc5 Semicolons terminate statements (#2665)
Statements, declarations, and definitions will terminate with either a semicolon
(`;`) or a close curly brace (`}`). Semicolons are never optional.

For example, with a semicolon, `x = x + 2;`. With a close curly brace,
`for ( ... ) { ... }`, or `class C { ...}`.

This does not affect any approved proposal; rather, it makes an important
assumption explicit.

Based on lead decision #1924

Fixes #2002
2023-03-16 14:17:39 -07:00
Geoff RomerandChandler Carruth 2cc64ee38a Clarify ambiguous phrasing in roadmap (#2678)
Previous phrasing was unclear, because "language work" sounds like it means language _design_ work.

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2023-03-15 13:07:35 -07:00
Aadarsh Raj 76b274b136 fixing word for greater and greater than equal symbol from comparison_operators doc (#2662)
### Greater symbol issue in doc file of comparison_operators

In doc, symbol of greater or greater than equal is write but word is miswritten  
so i just fix the word which is miswritten.
2023-03-09 08:26:46 -08:00
Aadarsh Raj 4e9e43a109 some issues in readme-file, replacing orange with apple (#2656)
**### There is issue in conditionals.md readme file** 
**In example of fruits conditionals** 
                            **there are fruits.IsGreen() if it is False then continue. 
                            if it is True then print "Apple" but in readme file there is "Orange"** 


I replaced "Orange" with "Apple" because in example there is "Apple" 
                    ```carbon
                                if (fruit.IsYellow()) {
                                  Print("Banana!");
                                } else if (fruit.IsOrange()) {
                                  Print("Orange!");
                                } else if (fruit.IsGreen()) {
                                  Print("Apple!");
                                } else {
                                  Print("Vegetable!");
                                }
                       fruit.Eat();
                        ```
2023-03-06 08:43:13 -08:00
Amr Hesham 21c3f64564 Fix doc rename struct to class (#2648)
Fix class declaration on the doc
2023-03-02 09:48:06 -08:00
Jon Ross-Perkins c7aff0a2a9 Fix quotes in multi-line string syntax (#2638)
This was pointed out by i-khadra on #2132
2023-02-27 14:17:04 -08:00
Avi Aaron 0a70614235 replace me with self 2nd try (#2631)
this is a second try after PR 2629,
I restarted from scratch since most changes were undone.
2023-02-23 21:54:45 -08:00
Avi Aaron 5d88871682 Fix incorrect use of "overridden", should be "overriding" (#2619) 2023-02-22 11:45:51 -08:00
Jon Ross-Perkinsandjosh11b e9480e7dfe Clean up a couple non-proposal docs links that had access issues. (#2565)
The toolchain link just needed a resourcekey.

The open discussion link may just not work because it was pre-go-public, so it points at a doc that we probably copied.

Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2023-01-30 11:33:18 -08:00
a89aba2698 Assignment statements (#2511)
Assignment is permitted only as a complete statement, not as a subexpression.
Assignment and compound assignment syntax follow C++ in all other respects.
Pre-increment is provided. Post-increment is not. Uses of all of these operators
are translated into calls to interface members.

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2023-01-27 19:03:47 -08:00
Jon Ross-PerkinsandRichard Smith 6a59c77715 Add a question for language version upgrades. (#2559)
Fixes #2229

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-01-27 16:46:56 -08:00
Chandler Carruth 9faf87e171 Roadmap for 2023 and retrospective for 2022 (#2551)
We propose a roadmap for 2023 focus on:

-   Progressing towards a concrete goal of an MVP / 0.1 language.
-   Engaging more broadly and deeply with the C++ community.

We also reflect on our overly ambitious
[roadmap for 2022](https://github.com/carbon-language/carbon-lang/blob/3d90a85f2439bb74b71a553c5017012369ec0f63/docs/project/roadmap.md)
and how the year went.
2023-01-24 15:44:39 -08:00
Richard Smith 4daaa4866f Rename Type -> type, per #2360. (#2507)
Also make minor updates to the skeletal design in
docs/design/name_lookup.md following #2113, as there are no longer any prelude names that are made available to unqualified name lookup by default.

Add `type` to the keyword list in
docs/design/lexical_conventions/words.md, following #2360.
2023-01-04 14:22:30 -08:00
josh11b 149107965c Clarify that named constraints in place of interfaces (#2479)
Current text was found to be confusing, see [2022-12-02 in #generics-and-templates](https://discord.com/channels/655572317891461132/941071822756143115/1048458269393424405).
2022-12-27 15:44:15 -08:00