From 69980b8e85d91a84106892ab9eecb2025ca878ba Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Mon, 24 Feb 2025 10:03:46 -0800 Subject: [PATCH 1/2] =?UTF-8?q?Replace=20=E2=80=9Cmember=20access=E2=80=9D?= =?UTF-8?q?=20with=20=E2=80=9Cfield=20access=E2=80=9D=20and=20=E2=80=9Cmet?= =?UTF-8?q?hod=20call=E2=80=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rust doesn’t have a single “member access” operator, but two different operators both using the dot. --- src/appendix-02-operators.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/appendix-02-operators.md b/src/appendix-02-operators.md index 6c8b8d89db..988de24c9e 100644 --- a/src/appendix-02-operators.md +++ b/src/appendix-02-operators.md @@ -37,7 +37,9 @@ overload that operator is listed. | `-` | `expr - expr` | Arithmetic subtraction | `Sub` | | `-=` | `var -= expr` | Arithmetic subtraction and assignment | `SubAssign` | | `->` | `fn(...) -> type`, |...| -> type | Function and closure return type | | -| `.` | `expr.ident` | Member access | | +| `.` | `expr.ident` | Field access | | +| `.` | `expr.ident(expr, ...)` | Method call | | +| `(` | `expr(expr, ...)` | Function call | | | `..` | `..`, `expr..`, `..expr`, `expr..expr` | Right-exclusive range literal | `PartialOrd` | | `..=` | `..=expr`, `expr..=expr` | Right-inclusive range literal | `PartialOrd` | | `..` | `..expr` | Struct literal update syntax | | From 0833386eab8f37c60b8d80e05fabc4a97d0628ee Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Tue, 25 Feb 2025 09:08:13 -0700 Subject: [PATCH 2/2] Appendix B: restructure handling of `.` and parens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Table B-8, instead of treating “tuples” as the primary concern, treat parentheses as primary and tuples as one of the contexts. Move the tuple index access to live alongside field and method access. --- src/appendix-02-operators.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/appendix-02-operators.md b/src/appendix-02-operators.md index 988de24c9e..5309a257bc 100644 --- a/src/appendix-02-operators.md +++ b/src/appendix-02-operators.md @@ -39,7 +39,7 @@ overload that operator is listed. | `->` | `fn(...) -> type`, |...| -> type | Function and closure return type | | | `.` | `expr.ident` | Field access | | | `.` | `expr.ident(expr, ...)` | Method call | | -| `(` | `expr(expr, ...)` | Function call | | +| `.` | `expr.0`, `expr.1`, etc. | Tuple indexing | | | `..` | `..`, `expr..`, `..expr`, `expr..expr` | Right-exclusive range literal | `PartialOrd` | | `..=` | `..=expr`, `expr..=expr` | Right-inclusive range literal | `PartialOrd` | | `..` | `..expr` | Struct literal update syntax | | @@ -170,9 +170,9 @@ Table B-7 shows symbols that create comments. | `/*!...*/` | Inner block doc comment | | `/**...*/` | Outer block doc comment | -Table B-8 shows symbols that appear in the context of using tuples. +Table B-8 shows the contexts in which parentheses are used. -Table B-8: Tuples +Table B-8: Parentheses | Symbol | Explanation | | ------------------------ | ------------------------------------------------------------------------------------------- | @@ -183,7 +183,6 @@ Table B-8 shows symbols that appear in the context of using tuples. | `(expr, ...)` | Tuple expression | | `(type, ...)` | Tuple type | | `expr(expr, ...)` | Function call expression; also used to initialize tuple `struct`s and tuple `enum` variants | -| `expr.0`, `expr.1`, etc. | Tuple indexing | Table B-9 shows the contexts in which curly braces are used.