Add keyword for alternatives in a match construct
See original GitHub issueedit @pokey:
As discussed in https://github.com/cursorless-dev/cursorless/issues/579#issuecomment-1161627378, we’d like to proceed as follows:
Original
There currently is no keyword for selecting alternatives in a match construct. Examples of match constructs are:
- Python
match x: case Alt1: exp1 … case AltN: expN
- Haskell
orf = case x of Alt1 -> exp1 … AltN -> expN
f Alt1 = exp1 … f AltN = expN
We probably want three keywords:
matched
to select the value matched on, i.e.,x
;<ordinal> pattern
to select the i’th pattern, i.e.,Alt1
toAltN
above; and<ordinal> case
to select the i’th case, i.e.,exp1
toexpN
above.
Unmodified pattern
and case
should probably to the scopes relative to the named mark or cursor, i.e., pattern
refers to Alt1
if the mark or cursor is in either Alt1
or exp1
, and similarly for case
.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Change keyword match types - Google Ads Editor Help
Select and edit specific keywords · Select Keywords. · Select the keywords to edit. · In the edit panel, select a new Match...
Read more >Python Match-Case Statement: Example & Alternatives - Udacity
In this article, we'll explain what a switch statement is in programming. Next, we'll show you how to use the match-case statement with ......
Read more >Keyword Match Types in Google Ads [Ultimate Guide] - Blog
Go to the Keyword section. In the Match type column, click on the arrow icon and set the match type.
Read more >What Is Phrase Match in Google Ads? - WordStream
Phrase match is a keyword match type option offered by Google Ads, formerly known as Google AdWords. In this tutorial, you'll learn: How...
Read more >PEP 622 – Structural Pattern Matching
This PEP proposes to add a pattern matching statement to Python, inspired by similar syntax found ... Pattern, a new syntactic construct, and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@pokey I like your proposal.
Ok I’ve edited my comment above with some new terms after a discussion with @AndreasArvidsson and @phillco. Tl;dr:
"case"
became"branch"
"condition"
became"subject"
or not supported"name"
added synonyms"key"
and"condition"
See the updated comment for discussion