Skip to content

Add "subject" scope type #1172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks
Tracked by #579
pokey opened this issue Dec 14, 2022 · 8 comments
Open
2 tasks
Tracked by #579

Add "subject" scope type #1172

pokey opened this issue Dec 14, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@pokey
Copy link
Member

pokey commented Dec 14, 2022

  • We'll begin by introducing the scope type extension side
  • Then when we support amalgamating more granular scope types, we'll figure out how we want to roll this one up

For original discussion, see #579 (comment) for more

image

@pokey pokey added the enhancement New feature or request label Dec 14, 2022
AndreasArvidsson added a commit that referenced this issue Dec 15, 2022
- Partially addresses
#1172
- Waiting to add Talon side until we're more confident in this scope
type
- Split from #831

## Checklist

- [x] Add Typescript
- [x] Add C
- [x] Add C#
- [x] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [x] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [x] I have not broken the cheatsheet

Co-authored-by: Michael Doronin <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Andreas Arvidsson <[email protected]>
pokey added a commit that referenced this issue Dec 21, 2022
- Partially addresses
#1172
- Waiting to add Talon side until we're more confident in this scope
type
- Split from #831

## Checklist

- [x] Add Typescript
- [x] Add C
- [x] Add C#
- [x] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [x] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [x] I have not broken the cheatsheet

Co-authored-by: Michael Doronin <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Andreas Arvidsson <[email protected]>
@wenkokke
Copy link

As I mention in #2177, "subject" is a generalisation of "condition".

@pokey
Copy link
Member Author

pokey commented Jan 18, 2024

huh that's kind of interesting. had never seen your if-else / switch equivalence before. repeated here for convenience

def ifThenElse(cond, ifTrue, ifFalse):
  match cond:
#       ^^^^  <-- "condition"
    case True:
#        ^^^^  <-- "pattern"
      return ifTrue()
    case False:
#        ^^^^^  <-- "pattern"
      return ifFalse()

I think I could be convinced that condition should be what's inside the parens. It visually feels like condition as well because of where it appears in the statement (at the top inside parens), which practically speaking is what matters the most 😄🦎🧠. cc/ @AndreasArvidsson

@AndreasArvidsson
Copy link
Member

AndreasArvidsson commented Jan 18, 2024

Inside the parens? Are you talking about the arguments to the function? Could you elaborate?

@wenkokke
Copy link

It should be the argument to match, right? The name in the parens is the function argument.

@pokey
Copy link
Member Author

pokey commented Jan 18, 2024

Letting "condition" refer to today's "subject". But not totally convinced

@AndreasArvidsson
Copy link
Member

I was never a fan of subject and would be fine with just using condition there as well.

@wenkokke
Copy link

Wait, was subject actually implemented?

@AndreasArvidsson
Copy link
Member

Yes but as a private scope

subject, private.switchStatementSubject

#1148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants