Commit Graph
211 Commits
Author SHA1 Message Date
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
31e907178f Termination algorithm for impl selection (#2687)
This proposal replaces the termination algorithm for `impl` selection. The previous algorithm relied on a recursion limit, which is counter to [our goal for predictability](/docs/design/generics/goals.md#predictability).

The replacement is to terminate if any `impl` declaration depends transitively on itself with a "strict superset" type as one of its parameters.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: Satakshi Garg <56358125+satakshigarg@users.noreply.github.com>
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2023-04-10 13:15:07 -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
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
Richard Smithandjosh11b 0b6411e6cc Associated constant assignment versus equality (#2173)
Split the `where A == B` constraint in two: `where .A = B` produces a new
constraint from an old one, where the value of `.A` in the new constraint is
known and eagerly rewritten to `B`, and `where A == B`, which does not cause
`A` and `B` to be considered as identical by language rules but does permit
implicit (no-op) conversion between them.
 
This aims to provide an efficiently-computable and human-understandable type
equality rule, with type canonicalization and therefore transitive type
equality, without sacrificing too much in the way of ergonomics and without
sacrificing determinism, while still providing the full power of a general type
constraint system in a less ergonomic form.

Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2023-02-01 10:03:30 -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
Chandler Carruth cad750c864 Finish an incomplete sentence in p2551. (#2554)
This was discussed in person with at least two of the leads while
drafting the text, but sadly it did not finish being typed into the
document.

Just amending the proposal text for the future as I don't think it
substantively changes the conclusions.

Thanks to @geoffromer for noticing this!
2023-01-24 16:08:41 -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
d70e237026 Pattern matching syntax and semantics (#2188)
This paper proposes concrete syntax and semantic choices for Carbon patterns.

Co-authored-by: josh11b <josh11b@users.noreply.github.com>
Co-authored-by: Geoff Romer <gromer@google.com>
Co-authored-by: David Sankel <camior@gmail.com>
2023-01-06 18:30:37 -08:00
16dcdc2a34 Types are values of type type (#2360)
Define a "type" to be a value of type `type`. Contexts expecting a type perform an implicit conversion to `type`. Values like `()` and `(i32, i32)` and `{}` are no longer types, but instead implicitly convert to `type`. Values of interface or constraint type (now called "facets") are similarly not formally types but implicitly convert to `type`.

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
Co-authored-by: josh11b <josh11b@users.noreply.github.com>
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2022-12-22 13:49:55 -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
josh11b ee998c99ff Clean up some small mistakes (#2451) 2022-12-07 15:12:08 -08:00
josh11bandRichard Smith d1210c4a50 Rename me -> self (#1382)
Carbon has been using a `me: Self` or `addr me: Self*` deduced parameter to mark a function as a method as decided in #494 and implemented in #722 . This does not match existing languages, and so this proposal switches `me` to `self` to match Python, Rust, and Swift.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-12-06 15:58:48 -08:00
josh11bandRichard Smith 571b869f1c Constraints must use Self (#2376)
Require `impl as` constraints in an `interface` or `constraint` definition to mention `Self` implicitly or explicitly. Require `where` clauses to refer to `.Self` directly, or through a designator like `.Foo`.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-12-02 16:11:23 -08:00
c9a1e351ba Template generics (#2200)
Add template generics, with optional constraints but no [SFINAE](https://en.cppreference.com/w/cpp/language/sfinae), to Carbon. Template generics allows the compiler postpone type checking of expressions dependent on a template parameter until the function is called and the value of that parameter is known.

Example usage:

```carbon
fn Identity[template T:! Type](x: T) -> T {
  return x;
}
```

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2022-11-17 10:23:52 -08:00
Jon Ross-PerkinsandRichard Smith 14cc716ddc Allow unqualified name lookup for class members (#2287)
Allow unqualified name lookup in multiple situations:

-   For classes and interfaces, whether inside the class scope or within an
    out-of-line function definition.
-   For namespaces, when the namespace is used in a declaration.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-11-09 14:34:30 -08:00
4885a2bf8e Subscript syntax and semantics (#2274)
Adds support for subscripting using the conventional square-bracket syntax, with support for both array-like and slice-like semantics.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2022-11-09 11:50:22 -08:00
josh11bandRichard Smith e29e4cfa29 What can be done with an incomplete interface (#2347)
Clarify what can and cannot be done with a incomplete interface or named constraint.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-11-09 08:37:25 -08:00
Chandler Carruth 0478cbd9b3 Remove artificial version ceiling on C++ interop. (#2365)
Remove a confusing mention of a specific version of C++ (C++17) from the
interoperability goals.

Expand the content of the goals to make it clear that we have a moving and
ongoing target of C++ as it continues to evolve. Also emphasize that we will
prioritize among the different features during Carbon's development based on how
they impact the overall project.

However, this intends to preserve the fact that there may exist long-tail or
corner-case features in C++ that never end up with high quality or exhaustive
support in our interop story simply because their impact on Carbon users is
sufficiently small that it doesn't justify the cost.

Fixes #1587
2022-11-02 19:29:05 -07: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
Chandler CarruthandCéline Dedaj b315c69f0c Begin publishing CoC and moderation transparency reports. (#2295)
Provides a documented cadence, publishing target, and template for Code of Conduct and moderation transparency reports.

Based on the initial proposal draft from @CelineausBerlin.

Co-authored-by: Céline Dedaj <CelineausBerlin@users.noreply.github.com>
2022-10-18 10:59:08 -07:00
josh11b e941b90ac9 Correctly remove ## TODO section from proposals (#2207)
Fix bug introduced in #2139
2022-09-22 08:20:07 -07:00
Jon Ross-Perkins 1dcd15380c Remove stacked PR notes (#2205)
chandlerc had originally added these and previously expressed being okay with removing them. They've just proven too complex to be applied; it needs to be easier for people to want to do it.
2022-09-21 16:10:36 -07:00
Richard Smith ff1d69232b Switch proposal link text from pNNNN to #NN for consistency (#2202)
This is the only occurrence of using pNNNN in text to refer to a Carbon proposal in the repo. This gets us closer to following https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/design_style_guide.md.
2022-09-21 10:37:07 -07:00
b464a0ac3d Unused Pattern Bindings (Unused Function Parameters) (#2022)
This proposal specifies how unused pattern bindings are written in the Carbon programming language. This is a more general problem statement of "how do users specify unused function parameters" as function parameter declarations are a more specific form of pattern

Related issue #1996

Co-authored-by: Geoff Romer <gromer@google.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-09-20 17:44:22 -07:00
josh11bandRichard Smith 83f1d29f3c Checked and template generic terminology (#2138)
Change terminology from "generics" and "templates" to "checked generics" and "template generics". Afterwards, "generics" will be an umbrella term that include templates.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-09-09 21:15:46 -07:00
49c9732e8e Numeric type literal syntax (#2015)
This proposal aims to add a literal syntax for fixed-sized numeric types: integers, unsigned integers, and floating-point numbers.

Fixes #1998

Co-authored-by: josh11b <josh11b@users.noreply.github.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-09-08 15:49:11 -07:00
josh11b e4595deb4b Clarify rules around Self and .Self (#2107)
A number of smaller changes grouped together in one proposal:

-   Make `Self` a keyword.
-   Clarify that `Self` refers to the current type in a base class and in impl declarations.
-   Clarify when `.Self` is legal, and what type it has.
-   Also specify that `where` is not an associative operator.
2022-09-08 13:04:58 -07:00
josh11b e489b14de0 Fix new_proposal.py to include "Abstract" section (#2139)
"Proposal" was hard-coded as the first section and so it was deleting the "Abstract" section along with the "TODO" section.
2022-09-01 14:21:04 -07:00
David Sankel 48ba8bf6b6 Are We Explorer Yet? (#1891)
It is currently difficult to see the status of Carbon explorer and where effort
is needed. We propose creating a AreWeYet-styled dashboard to address this.
2022-08-26 11:50:22 -07:00
David Sankel ea0a37dbf3 Add Abstract Section (#1895)
Reading through extensive problem and background documentation before seeing
what is being proposed is tedious for a reader. An abstract section at the
beginning of a document that provides a succinct summary helps a lot. We
propose adding such a section to our proposal template.
2022-08-26 11:49:25 -07:00
ba2cfc2d0d Weaken digit separator placement rules (#1983)
[Proposal #143: Numeric literals](https://github.com/carbon-language/carbon-lang/blob/trunk/proposals/p0143.md) added digit separators with strict rules for placement. It missed some use-cases. In order to address this, remove placement rules for numeric literals.

Related issue: #1485 

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-08-25 14:52:43 -07:00
07d6a03b32 Change raw string literal syntax: [#]*" represents single-line string and [#]*''' represents block string (#1360)
Use `"` for simple string literals and `'''` for block string literals.

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-08-25 14:04:22 -07:00
Jon Ross-Perkins 065d5224be Remove reviewer setting, let autoassign take over (#2094)
Fixes #1841

The current autoassign doesn't work, but I'm trying to fix it (e.g., #2093)
2022-08-23 12:13:41 -07:00
Jon Ross-Perkins 15d1e07133 Unicode char limit (#2040)
The `\u{HHHH...}` can be an arbitrary length, potentially including `\u{}`.
Restrict to 1 to 8 characters.
2022-08-16 09:41:52 -07:00
Geoff Romer 4b56764f10 Fix link to accepted proposals (#2019) 2022-08-12 16:13:11 -07:00
Jon Ross-Perkins 9b3f80c6d6 Switch proposal process from projects to labels (#1981)
This is being done because Projects v1 requires repo write access, a serious limitation for letting people use it. Projects v2 isn't a great option because it lacks event support. Labels are pretty stable in GitHub, so this switches to that.

Note this assumes we're fine renaming "decision: accepted" -> "proposal accepted", etc. There are two reasons for this:

1) To make it clear that this is a proposal-specific label, versus something like an issue for leads label.
2) Removing the colon because it was causing trouble with yaml syntax.

This also adds the "proposal draft" label, mainly to complete the taxonomy.

I was considering whether this should be a proposal itself, but it feels like maybe it's not necessary because it's a fairly low-key infrastructure change, and I'm not sure how much people were relying on the project board anyways.

I tested this in a personal repo, basically just poking at https://github.com/jonmeow/test/pull/2
2022-08-12 11:11:09 -07:00
Krishna Agarwal bb0aac61a3 Typo fixes in proposals (#1965)
Some errors and typos in the proposals
2022-08-11 12:06:51 -07:00
Jon Ross-Perkins b9e6f82f5d Remove project flag (#1939)
Contributors can't do this right now (requires repo write permissions), need to investigate as part of #1898 (projects v1 vs v2 results may differ)
2022-08-06 14:22:37 -07:00
josh11b 6210353dfe Update links to open discussion minutes archives (#1873) 2022-08-01 16:46:19 -07:00
josh11b 64f3284a19 Update links to visible copies of docs (#1786)
I've manually copied some Google docs that were referenced in our design .md files so they may be publicly viewable.
2022-07-27 17:45:05 -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
FirstSS 8ed38c42f3 Fixed typo (#1473) 2022-07-20 14:55:54 -04:00
cui fliter e8206bf4bf fix some typos (#1444)
Signed-off-by: cui fliter <imcusg@gmail.com>
2022-07-20 07:01:47 +03:00
8dd878b314 Remove CODEOWNERS (#1367)
Remove CODEOWNERS and rely on repository commit access

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: Geoff Romer <gromer@google.com>
2022-07-15 15:31:56 -07:00
4aa462c2ac Make the Carbon experiment public. (#1363)
This is a proposal to make the Carbon experiment public.

We have not yet hit many of the originally suggested criteria for going
public. However, this proposal suggests that increasingly there is more
value to moving public sooner rather than waiting to hit these criteria.
We are increasingly unable to substantially learn more about the broader
interest in Carbon without it being public and we increasingly see value
in working with the industry to build and shape the language.

Given this, the proposal removes the old plan-of-record and suggests
a concrete set of steps to make the experiment public in the immediate
future.

This is not a change that we can make lightly to the project, and so we
worked to check with as many folks as we could first and all three
leads were unanimous to move forward here.

Note that this proposal was originally discussed in PR #1315.

Co-authored-by: josh11b <josh11b@users.noreply.github.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-07-01 18:11:40 -07:00
df345b5ec7 Remove LLVM from the repo, and clean up history. (#1344)
This proposal establishes a plan for moving away from the embedded copy
of LLVM and instead downloading it with Bazel.

The goal is that after this lands, we will do a history-rewrite to
cleanup the repository. There are instructions on how folks can move any
in-flight work over to the newly tidied repo.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2022-06-28 13:49:38 -07:00
josh11b b83f5c3fc7 Generics: impl forall (#1327)
Implement the decision in #1192 to use this syntax for parameterized impls:

> `impl forall [`_generic parameters_`]` _type_ `as` _constraint_ ...
2022-06-14 19:35:53 -07:00
bc40bdc279 Principle: All APIs are library APIs (#1280)
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-06-13 13:10:43 -07:00
b62b7464a4 Update and expand README content and motivation for Carbon (#1270)
Some review feedback from outside the team directly working on Carbon suggested
two pretty significant updates here. First, we didn't do a good job of
motivating Carbon. This takes two parts, first explaining what we'd like to
accomplish with this approach generally, and second explaining why alternative
approaches don't work. A particularly difficult case here is articulating
effectively the difficulties that motivate an approach other than improving C++
incrementally.

Co-authored-by: Jon Meow <jperkins@google.com>
Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2022-06-06 17:16:27 -07:00