-
Notifications
You must be signed in to change notification settings - Fork 89
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
Support multiple parameters to pattern matching #36
Comments
implicit fall through and EDIT: trotyl good catch. I am leaving this here although you are right they are different. |
@limeblack This is not talking about fall through, but matching multiple parameters at the same time. |
But this is not relevant to |
Yeah, multiple simultaneous parameters to the |
@aem Seems you are proposing a solution for a problem which doesn't exists. You read multiple arguments in a function call There is no sense to try match a data structure (tuples) which doesn't exists on JavaScript. After all it will be a quickfix behind the scenes to translate it to Array, If you want to achieve a data structure match in a real world scenario is much more sane calling [{a: 1, b: 2, ...xs}]: {},
[{a: 'jordan', b: 'marie', ...xs}]: {}, rather than |
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 multiple patterns go: we decided to move this feature into the "Beyond This Spec" section. It -would- be very nice, and my earlier draft of the proposal included this (both in AND and OR forms), but after discussions and a bit of bikeshedding, it became clear that this would be a much bigger discussion, and I'd rather not block the initial proposal on this, since I consider it non-essential (based on how this sort of feature is not nearly universal in pattern matching implementations). |
While JavaScript doesn't have a formal concept of a tuple, matching multiple values in one statement rather than using nested
match
statements would be nice. A proposed syntax using commas draws from Swift:Without the multiple match syntax, this code expands to the following:
The text was updated successfully, but these errors were encountered: