-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Stabilize fixed-length slice patterns (excluding ..) #48836
Copy link
Copy link
Closed
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language teamfinal-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.In the final comment period and will be merged soon unless new substantive objections are raised.
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language teamfinal-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.In the final comment period and will be merged soon unless new substantive objections are raised.
Type
Fields
Give feedbackNo fields configured for issues without a type.
This is a sub-issue of the larger tracking issue for slice patterns (#23121). It specifically tracks the plans to stabilize fixed-length slice patterns -- that is, excluding the
..operator (which is entangled with some syntactic questions). There is an implementation PR in #48516.Summary
Using this feature, a pattern like
[a, b, c]can be used to match against fixed-length arrays:One can also use such a pattern to match against slices:
Notable points and tests
Here are some of the things I think we should be testing. I didn't have time to find if we have all these tests, perhaps someone can help (cc @petrochenkov, @mikhail-m1 ?)
let [a, b] =) applied to fixed-length to move things outlet [a, b] =) applied to create referencematch-vec-fixedtests that we get warnings for two slice patterns of same lengthThings not stabilized