Commit Graph
355 Commits
Author SHA1 Message Date
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
Jon Ross-Perkins c5f4e65fdd Add parentheses to remove ambiguity for %. (#2478) 2022-12-20 17:51:05 -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 ee998c99ff Clean up some small mistakes (#2451) 2022-12-07 15:12:08 -08:00
josh11b 9165b084f4 Can't override virtual methods in an adapter (#2450)
This is just a consequence of casting to an adapter type doesn't change the data, including the vtable pointer.
2022-12-07 15:11:31 -08:00
josh11b 9c8fd6864e Implement rename me -> self (#2444)
Implements change proposed in #1382

Replaces #1624
2022-12-06 20:17:00 -08:00
Avi levy 94c207158e llvm-ar no such file or directory fix instruction (#2423)
Add link to llvm-ar error fix instruction.
2022-12-05 14:02:58 -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
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
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
Nico Z 4ea3e1951b Add ubuntu:22.04 docker images (#1618)
Ubuntu 22.04 base image and examples using github, a copy instruction and volumes.

I was using this to run examples on a windows machine since it is more comfortable than switching OS or using the WSL subsystem directly.
If this is something that other people would like to have  I can add other versions of ubuntu and other linux distributions.
2022-11-03 13:12:21 -07: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
Richard Smith dca7214c25 Update design to use current impl syntax. (#2309) 2022-10-24 14:16:41 -07:00
Jon Ross-Perkins bd3e2bb24a Add alternatives considered to classes (#2332)
Extracting from #2287
2022-10-24 09:39:01 -07:00
Chandler Carruth d76835bed4 Fix a missing link and tweak the template. (#2330)
Mostly wanted to more clearly separate the closing observations from the
rest of the report. Noticed the missing link while I was there so fixing
that too.
2022-10-21 08:02:46 -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
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
Kareem Ergawyandergawy 05b6c4f310 Fix a few typos in generics docs. (#2272)
Fixes a few tiny typos here and there.

Co-authored-by: ergawy <kareem.ergawy@guardsquare.com>
2022-10-07 09:31:38 -07:00
Adrien Leravat 8e8e8ced60 docs: fix code sample typo (#2254)
Fix small typo in classes documentation
Added to a decicated PR to keep things orderly
2022-10-04 08:57:10 -07:00