Skip to content

[patterns] Change if-case statement syntax to a more infix-like form. #2191

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 1 commit into from
Apr 6, 2022

Conversation

munificent
Copy link
Member

Instead of:

if (case [int x, int y] = json) return Point(x, y);

The proposed syntax is now:

if (json case [int x, int y]) return Point(x, y);

This does not define an infix case expression. But it is more
forward-compatible with that syntax if we decide to do that later.

See #2181.

Instead of:

  if (case [int x, int y] = json) return Point(x, y);

The proposed syntax is now:

  if (json case [int x, int y]) return Point(x, y);

This does *not* define an infix case *expression*. But it is more
forward-compatible with that syntax if we decide to do that later.

See #2181.
@munificent munificent requested a review from leafpetersen April 5, 2022 23:48
@munificent munificent merged commit 2882a64 into master Apr 6, 2022
@munificent munificent deleted the if-case branch April 6, 2022 14:30
Copy link
Member

@leafpetersen leafpetersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do find this more readable.

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.

2 participants