-
Notifications
You must be signed in to change notification settings - Fork 50
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
Exhaustivity checking #34
Comments
@Risto-Stevcev What is your complain with the current way of only returning |
If the |
@Risto-Stevcev yes indeed, at v0.x.x we was closer to these classical pattern matching specifications, however it wasn't well accepted since is too different from JS world. The decision to return I'll maintain that issue open for more people opine on that subject as well. |
I'm against to throw an error on this case, because of the friction it causes. In this line, I would rather return an Also, the check that it is "exhaustive" would be to ensure that there is always a |
In Haskell you can define partial pattern matching. In those cases if you hit a case that isn't handled it'll immediately throw an error, the value won't silently propagate into your program. Same with Elixir, it immediately throws. |
Hey, I'm closing due inactivity, I truly understand the argument but we are aligned with JS community and JS "way of life" and we didn't get any complaints about that so far, any other news we reopen this issue, thanks for you all collaboration! |
@leonardiwagner One other approach: you could make it optional, ie. a setting to make it 'stricter' and throw an exception, or to have the more lax/flexible version |
@Risto-Stevcev sure, great idea! |
Have an option that checks if the matching is exhaustive, and if it isn't then have it immediately throw an error that the matching isn't exhaustive.
The text was updated successfully, but these errors were encountered: