Commit Graph
66 Commits
Author SHA1 Message Date
josh11bandJosh L db78450c61 Fix singular/plural mismatch in design README (#4326)
Co-authored-by: Josh L <josh11b@users.noreply.github.com>
2024-09-19 20:58:57 +00:00
Richard Smith 6bbbd4ec1f More consistent package syntax (#3927)
Change the syntax for `package` declarations from:

```carbon
[package Foo] [library "bar"] api;
[package Foo] [library "bar"] impl;
```

to

```carbon
[package Foo] [library "bar"];
impl [package Foo] [library "bar"];
```
2024-05-16 00:55:37 +00:00
21fb6f5802 Update broken links (#3786)
Update broken links to aid in following links while perusing the
documentation. Closes #3778

I don't imagine I got every one of these right. Some 404s may be
reported due to permissions.

Using the lychee command in #3778, only the following link is reported
as not found, but it's just a permission issue:

```
[proposals/p1367.md]:
✗ [404] https://github.com/carbon-language/carbon-lang/settings/access | Failed: Network error: Not Found
```

I tried to get it down to as few as possible, partially so that future
link scans won't run into repeat errors.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
2024-03-22 18:42:20 +00:00
Nathan Youngman 10189bbb78 rephrase a few sentences (#3766)
Minor tweaks while reading through the docs to hopefully improve
readability.
2024-03-13 22:03:34 +00:00
josh11bandChandler Carruth 58c106010c Updates to design docs to reflect accepted proposals (#3254)
Includes proposals:
- #990
- #2188
- #2138
- #2200
- #2360
- #2760
- #2964
- #3162

Also tries to use more precise language when talking about:
- implementations, to avoid confusing `impl` declaration and definitions
with the `impls` operator used in `where` clauses, an issue brought up
in #2495 and #2483;
- "binding patterns", like `x: i32`, and "bindings" like `x`.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2023-09-23 15:53:07 +00:00
josh11bandRichard Smith a8ca499450 Updates to generics design details, part 1 (#3231)
First step in updating `docs/design/generics/details.md`. It
incorporates changes from proposals: #989 #2138 #2173 #2200 #2360 #2964
#3162 , but there are still more changes from those proposals to be
made.

It also switches away from suggesting static-dispatch witness tables,
and creates an appendix to describe that decision.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-09-19 19:06:47 +00:00
josh11bandRichard Smith 71f2eecec5 Update design overview to reflect submitted proposals (#3180)
Incorporates proposals: #1885, #2138, #2188, #2200, #2360, #2760, #2964,
and #3162.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-09-08 22:04:48 +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
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
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
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
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
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 5d88871682 Fix incorrect use of "overridden", should be "overriding" (#2619) 2023-02-22 11:45:51 -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
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 8e29547911 Move numeric_literals.md design doc into expressions/literals.md and update (#2459)
Follow-on to change #2410 which created the `expressions/literals.md` home for literal expressions. Incorporates the decision in #2113 to address a TODO.
2022-12-13 16:31:02 -08:00
Geoff RomerandRichard Smith 44ba541f1f Update sum types design (#2187)
This proposal updates the design of [p0157](https://github.com/carbon-language/carbon-lang/blob/trunk/proposals/p0157.md) to reflect subsequent evolution of the language.

Resolves #1805 

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-12-12 14:08:05 -08:00
Geoff Romer 0bf4d11ced Design documentation for indexing (#2388)
Update the design documentation to reflect #2274.

The contents are largely copy-pasted from p2274.md with minor edits, but the "Open questions" section is new.
2022-12-10 01:25:04 -08:00
dd2f7d732c Design updates for #2015 numeric type literal syntax (#2410)
Edit numeric literal design for the literal type proposal and add reference where #2015 was mentioned.

Closes #2159 

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2022-12-09 11:01:21 -08:00
josh11b 9c8fd6864e Implement rename me -> self (#2444)
Implements change proposed in #1382

Replaces #1624
2022-12-06 20:17:00 -08:00
Jon Ross-Perkins f1e36a50ca C/C++ -> C and C++ (#2340)
As requested at https://github.com/carbon-language/carbon-lang/pull/2332#discussion_r1002257672, "Very minor, but "C/C++" irritates some people in the C++ community so we may as well avoid it here."
2022-10-25 12:06:24 -07:00
Richard Smith dca7214c25 Update design to use current impl syntax. (#2309) 2022-10-24 14:16:41 -07:00
Jon Ross-Perkins 4601a9cce8 Modify package in the README.md to mark unreviewed ideas as provisional. (#2324)
I've filed #2323 to track the design idea for `package`, and #2001 already tracked `import`, but these should be explicitly marked as provisional.
2022-10-20 14:51:52 -07:00
Geoff Romer 96735e89b8 Clarify that l-values and r-values are expressions (#2243) 2022-09-30 13:34:11 -07:00
josh11bandBarry Revzin 29d8f9845e Clarifications to "checked and template parameters" (#2216)
This attempts to address concerns that @brevzin first tried to fix in #1443 .

Co-authored-by: Barry Revzin <barry.revzin@gmail.com>
2022-09-26 16:57:03 -07:00
josh11b 14206da00a Primitive types (#1975)
A few changes:
- Merge content from the `primitive_types.md` design doc into the overall design `README.md` since there was so much overlap and no need for two copies.
- Consistently spell integer types `Carbon.Int(N)` and `Carbon.UInt(N)`, including the `Carbon.` prefix and avoiding `Unsigned(N)`.
- Consistently use a comprehensive set of floating-point types.
- Incorporates #2015 into the design docs.
2022-09-08 18:13:09 -07:00
Prithvi Jamadagni 661a3c3907 Reflect "Numeric literal semantics #144" in the design docs (#2092)
This PR aims to complete issue #1997.
2022-09-02 17:49:14 -07:00
dd4deb6843 Redo introduction of design overview (#2017)
Previous overview is changed to an introduction that includes a modified first example, and adding a brief tour of Carbon in the form of an explanation of the features demonstrated in that example. Also update to reflect that we expect `Print` to be available in some package imported by default, which we are currently calling `Carbon`.

Co-authored-by: Wolff Dobson <wolffg@users.noreply.github.com>
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2022-08-29 20:20:18 -07:00
Jon Ross-Perkins 9572a33ba9 Update digit separator notes in design (#2117) 2022-08-29 16:10:51 -07:00
09e4417431 Mark what is provisional in the design overview (#1984)
Also references were added to clarify that some features are not provisional.

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: Geoff Romer <gromer@google.com>
2022-08-11 14:48:35 -07:00
josh11b 3276903cee Add alias use case example (#1980)
Motivated by [a conversation in #properties on Discord](https://discord.com/channels/655572317891461132/1007005822821347328/1007016175630295060).
2022-08-10 21:34:54 -07:00
Richard Smith 8af9ebda88 Remove mention of i256 and u256 (#1911)
For now, only document up to 128-bit support given that's all that LLVM supports, in particular for division.
2022-08-04 09:44:16 -07:00
Shakeel MahateandJon Ross-Perkins 79df59b1dd Incomplete sentence in _let bindings_ (#1697)
The original sentence was grammatically unsound, specified the three options of copy, move or pointer binding in parenthesis and some words around it.

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2022-08-02 10:12:29 -07:00
Josh Soref 066b103881 Spelling (#1580)
This PR corrects misspellings identified by the [check-spelling action](https://github.com/marketplace/actions/check-spelling).

The misspellings have been reported at https://github.com/jsoref/carbon-lang/commit/38a1c1640151899fd6da0442a92557f9543b6280#commitcomment-79197316

The action reports that the changes in this PR would make it happy: https://github.com/jsoref/carbon-lang/commit/173c8f9083a68aa61f7cfe94f720f1e5dc7f1ea3

Note: this PR does not include the action. If you're interested in running a spell check on every PR and push, that can be offered separately.

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-07-22 16:14:21 -07:00
josh11b a96ae98155 Fixes to example code in design overview (#1516)
Fix `-` -> `+` in `Distance`. Typo noticed by gingerBill in https://www.youtube.com/watch?v=Z_8lV0nwsc4  .
Also update factory function names `Create` -> `Make`, to reflect latest thinking.
2022-07-21 10:52:38 -04:00
Arno Gourdol d21acc95f9 Spelling, grammar (#1478) 2022-07-20 18:40:16 -04:00
Ryan Russell aa4ce80907 docs(design): improve readability (#1431)
Readability improvements focused on `docs/design/.md`

Signed-off-by: Ryan Russell <git@ryanrussell.org>
2022-07-19 17:45:45 -04:00
53053e5959 Design overview update part 7: values (#1378)
This follows #1274 , #1325 , #1328 , #1336 , #1347 , and #1368 . This fills in details about how values work, value categories, parameter passing, unformed state, and so on.

Co-authored-by: Geoff Romer <gromer@google.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2022-07-15 14:42:39 -07:00
josh11bandJon Ross-Perkins 77df7c56d9 Design overview update part 6 (#1368)
This follows #1274 , #1325 , #1328 , #1336 , and #1347 . This has miscellaneous changes to the design overview without a particular focus.

Also adds some missing keywords to our list of keywords.

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2022-07-07 22:05:41 -07:00
5535f5ee30 Design overview update part 5: Names (#1347)
This follows #1274 , #1325 , #1328 , and #1336 . It fills in the "Names" section.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2022-07-06 16:57:25 -07:00
fbf353afe8 Design overview update part 4: C and C++ Interop (#1336)
This follows #1274 , #1325 , and #1328 . It fills in the "Bidirectional interoperability with C and C++" section.

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
Co-authored-by: Geoff Romer <gromer@google.com>
2022-06-27 17:20:24 -07:00
josh11bandChandler Carruth d37dfd2fb8 Design overview update part 3: Safety (#1328)
This follows #1274 and #1325 and fills in the "safety" section. It only covers our approach in general terms.

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2022-06-14 13:22:22 -07:00
josh11bandChandler Carruth 504a4b1364 Design overview update part 2 (#1325)
This follows #1274 . It mainly fills in the "generics" section, with smaller updates to other section.

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2022-06-12 15:36:29 -07:00
b17e69aefd Design overview update part 1 (#1274)
Reorganizes the sections, and makes a pass filling in and updating the first sections including: types, functions, user-defined types. The following sections are left for part 2, including names, generics, and interop.

Also some smaller updates to, not revisiting the text: `pattern_matching.md`, `control_flow/return.md`, and `lexical_conventions/numeric_literals.md`

Co-authored-by: Geoff Romer <gromer@google.com>
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2022-06-09 12:58:22 -07:00
josh11bandRichard Smith d7a90609cc Update docs/ READMEs (#1211)
With a focus on making each README a good representation for its directory, and adding links.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-04-27 12:07:53 -07:00
Jon Meow 979fe2cd89 Merge naming conventions #861 into the design (#1056)
A pretty straight copy of #861. Cutting down README.md example text since it seemed a little redundant with examples in the bullets.
2022-01-28 18:14:31 -08:00