Champion "and, or, and not patterns" (VS 16.8, .NET 5)
- Dominant language
- C#
- Stars
- 12.7k
- Forks
- 1.1k
- Avg merge
- 11h 1m
- Merged PRs (30d)
- 3
Description
- [ ] Proposal added
- [ ] Discussed in LDM
- [ ] Decision in LDM
- [ ] Finalized (done, rejected, inactive)
- [ ] Spec'ed
The idea is to add three new pattern forms
1. *pattern* `and` *pattern*
2. *pattern* `or` *pattern*
3. `not` *pattern*
The latter two would not be permitted to define pattern variables in the subpatterns (as they would never be definitely assigned).
We'd have to decide on syntax and precedence, and whether some mechanism such as parentheses could be used for grouping patterns to override precedence.
Examples:
``` c#
switch (o)
{
case 1 or 2:
case Point(0, 0) or null:
case Point(var x, var y) and var p:
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.