Features of a pattern matching syntax
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
> **Note** The latest version of the design based on these principles can be found [here](https://github.com/dotnet/vblang/issues/337#issuecomment-601614253).
**What features / attributes should a VB.NET pattern matching syntax have?**
I propose the following:
* **Allow the same syntax for patterns in a boolean-returning expression (introduced with a dedicated keyword), as for patterns in a Case clause.** This enables patterns to be used as the condition of `If ... Then`, `Do While ...` blocks and the like.
* **Allows the pattern to introduce variables into the child scope** -- this will be either the `Case` block or the block following the match expression
* **Pattern-neutral**, not oriented specifically to a type-checking pattern
* **Allow `When` clauses** for additional conditions
* **Allows for nested patterns** -- certain pattern types can contain other patterns
I've written some examples, and a proposed spec in line with these goals [here](https://github.com/dotnet/vblang/issues/124#issuecomment-416292181). But the purpose of this issue is to discuss whether these goals are valid and relevant.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.