Skip to content

Improve condition support for Python and Rust #1147

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

Merged
merged 13 commits into from
Dec 22, 2022

Conversation

pokey
Copy link
Member

@pokey pokey commented Nov 18, 2022

  • Adds condition support for Python ternaries
  • Adds condition support for Python list comprehensions
  • Adds condition support for Python match statements
  • Adds condition support for Rust match statements
  • Note that "chuck" includes the if keyword for match statements and list comprehensions
  • Split from Pattern matching support #831

Checklist

Co-authored-by: Michael Doronin warrior2031@mail.ru

@pokey pokey requested a review from auscompgeek November 18, 2022 17:10
@pokey pokey mentioned this pull request Nov 18, 2022
@auscompgeek
Copy link
Member

Seems reasonable. I presume if clauses in Python list comprehensions are treated similarly?

@pokey
Copy link
Member Author

pokey commented Dec 13, 2022

Seems reasonable. I presume if clauses in Python list comprehensions are treated similarly?

Hmm I don't believe that they are. Does make me wonder if it's what we want; feels a bit small for "if state", as it's not a full statement. Ie "state" should be a superset of "if state", and I don't think "state" wants to get trapped this far down

Otoh I do sometimes find myself wanting to target the if in python comprehensions

cc/ @AndreasArvidsson wdyt

@AndreasArvidsson
Copy link
Member

I guess it's similar to trying to target a ternary in other languages. I do agree that if statement isn't the best description for any of those, but it probably would be useful to be able to target them.

@pokey
Copy link
Member Author

pokey commented Dec 15, 2022

Discussed in meet-up:

  • We'd like to switch this to condition
  • For "change" it doesn't include the if keyword
  • For "chuck" it does include the if keyword

@pokey pokey changed the title [rust] Support if component of case statements Improve condition support for Python and Rust Dec 15, 2022
@pokey
Copy link
Member Author

pokey commented Dec 15, 2022

@purpleP fyi we are now using "condition" instead of "if state" here

@pokey pokey force-pushed the pokey/rust-support-if-component-of-case-statements branch from 4446871 to 68e020a Compare December 21, 2022 19:17
@pokey pokey requested a review from auscompgeek December 21, 2022 19:22
@pokey pokey merged commit d903872 into main Dec 22, 2022
@pokey pokey deleted the pokey/rust-support-if-component-of-case-statements branch December 22, 2022 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants