Skip to content
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

Switch syntax sugar #725

Open
emil14 opened this issue Oct 4, 2024 · 0 comments
Open

Switch syntax sugar #725

emil14 opened this issue Oct 4, 2024 · 0 comments
Labels

Comments

@emil14
Copy link
Collaborator

emil14 commented Oct 4, 2024

See #724 for context. These forms should be equivalent:

Before (desugared)

def Foo(n int) (n int) {
    Switch<int>
    Bar, Baz, Bax
    ---
    :n -> switch:data
    1 -> switch:case[0] -> Bar
    2 -> switch:case[1] -> Baz
    switch:else -> Bax
    [bar, baz, bax] -> :n
}

After (sugar)

Given #726 (comment) switch will probably look like this:

v -> switch {
    sender_1 -> receiver_side_1
    sender_2 -> receiver_side_2
    ...
    default -> receiver_side_N
}
@emil14 emil14 added the Idea label Oct 4, 2024
@emil14 emil14 changed the title Switch expression/statement connection syntax sugar Switch syntax sugar Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant