Commit Graph
183 Commits
Author SHA1 Message Date
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
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
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
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
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
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
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
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
micttyl dc4e968373 Fix Markdown (#2208)
`explicit parameter` to have its closing rendered correctly.

Change all html-like(still supported though) notations into the Markdown style.
2022-09-22 09:01:36 -07:00
josh11b e873678c8f Link to Rust stabilizing Generic Associated Types (GATs) (#2178) 2022-09-13 16:39:19 -07:00
Richard Smith deee3a97de Implement #2140 in the design docs. (#2176)
This implements #2140 in the design docs.
2022-09-13 14:54:43 -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
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
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
josh11b 4192ee42a6 Misc small fixes (#2123) 2022-08-30 08:25:24 -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
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
David Poliakoff b342fac618 Spelling fix in the generics overview doc (#2016)
Minor usage fix in generics doc
2022-08-16 10:43:39 -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
90babcddc1 Revise associated types and interface parameters in Generics terminology (#1972)
Previous text was not clear, see https://discord.com/channels/655572317891461132/941071822756143115/1004607504396861540 .

Co-authored-by: Thomas Heller <thom.heller@gmail.com>
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2022-08-15 15:00:00 -07:00