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

How implicit do expressions impact this proposal? #55

Closed
krzkaczor opened this issue Nov 19, 2017 · 2 comments
Closed

How implicit do expressions impact this proposal? #55

krzkaczor opened this issue Nov 19, 2017 · 2 comments

Comments

@krzkaczor
Copy link

Hi!

there is an idea for implicit/aggressive do expressions tc39/proposal-do-expressions#9 and facebook/jsx#88 (for jsx). This basically makes various statements in JS expressions (ex. switch would be an expression).

With this in mind, maybe instead of adding a new keyword match, improving switch would be a better idea. CSharp recently did something similar — they added special powers to good old switch statement instead of adding a new keyword (unfortunately switch is still a statement which sucks but we would avoid it).

I wonder if this was discussed somewhere already?

CC: @xtuc

@vincentdchan
Copy link

I believe they are different. Do expression is trying to convert some statements into expressions, including the implicit one. Pattern matching is more than that, it can bind variable, it supports nested matching, not just something like switch.

@zkat
Copy link
Collaborator

zkat commented Mar 25, 2018

Hey y'all! #65 has gotten merged, and a lot of issues have become irrelevant or significantly changed in context. Because of the magnitude of changes and subtle differences in things that seem similar, we've decided to just nuke all existing issues so we can start fresh. Thank you so much for the contributions and discussions and feel free to create new issues if something seems to still be relevant, and link to the original, related issue so we can have a paper trail (but have the benefit of that clean slate anyway).

As far as this goes: I am explicitly not intending to overload switch, and its semantics, on several levels, are very very different from the goal semantics of match, even if the high-level concept seems similar. The new spec takes a number of specs to distance itself from familiarity with switch for that reason.

@zkat zkat closed this as completed Mar 25, 2018
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

No branches or pull requests

3 participants