-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.
Description
The ability to specify in a match statement that given some results the execute in top down order of all the statements that match.
Example:
Current:
match cmp.compare(&array[left], &array[right]) {
Less => {
merged.push(array[left]);
left += 1;
},
Equal => {
merged.push(array[left]);
merged.push(array[right]);
left += 1;
right += 1;
},
Greater => {
merged.push(array[right]);
right += 1;
}
}my proposal for the new syntax:
match all cmp.compare(&array[left], &array[right]) {
Less, Equal => {
merged.push(array[left]);
left += 1;
},
Greater, Equal => {
merged.push(array[right]);
right += 1;
}
}Basically this would be an extension to the current patterns where a comma signifies an overlapping qualifier meaning that if the value matches the overlap then it executes the code and then continues on searching.
Metadata
Metadata
Assignees
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.