Skip to content

Commit 9f146c1

Browse files
committed
Add feature gate; remove special syntactic support for nested indices
1 parent 316a69f commit 9f146c1

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Diff for: active/0000-tuple-accessors.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
Summary
66
=======
77

8-
Add simple syntax for accessing values within tuples and tuple structs.
8+
Add simple syntax for accessing values within tuples and tuple structs behind a
9+
feature gate.
910

1011
Motivation
1112
==========
@@ -26,11 +27,12 @@ Detailed design
2627
===============
2728

2829
Add syntax of the form `<expr>.<integer>` for accessing values within tuples and
29-
tuple structs. This syntax is recognised wherever an unsuffixed integer or
30-
float literal is found in place of the normal field or method name expected when
31-
accessing fields with `.`. Float literals in this position are expanded into two
32-
field accesses, so that an expression of the form `a.1.3` is equivalent to
33-
`(a.1).3`.
30+
tuple structs. This (and the functionality it provides) would only be allowed
31+
when the feature gate `tuple_indexing` is enabled. This syntax is recognised
32+
wherever an unsuffixed integer literal is found in place of the normal field or
33+
method name expected when accessing fields with `.`. Because the parser would be
34+
expecting an integer, not a float, an expression like `expr.0.1` would be a
35+
syntax error (because `0.1` would be treated as a single token).
3436

3537
Tuple/tuple struct field access behaves the same way as accessing named fields
3638
on normal structs:

0 commit comments

Comments
 (0)