-
Notifications
You must be signed in to change notification settings - Fork 103
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 "or" patterns - multiple patterns for one match branch #691
Comments
We actually have an or-pattern constructor internally. I think it's just a question of writing an elaboration pass that removes it, as not all our theorem prover targets support or-patterns. Probably the simplest re-write is into guards:
becomes
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rust and OCaml, and I assume other languages that support Sail's style of pattern matching let you have multiple patterns for one match branch:
It would be nice if Sail supported this. Not a major issue at all but I and a few other people have been slightly caught up by it a few times.
Also I dunno if I like the
|
syntax because it has such strong ambiguity with bool/bitwise or. Like, this code is not obvious:Does that mean it will match
a
orb
, ora bitwise_or b
? I would suggest using a comma if possible:Maybe slightly unexpected to people familiar with Rust/OCaml/etc. and it does have potential confusion with tuples, but I reckon it's still better.
The text was updated successfully, but these errors were encountered: