This is the initial issue to reopen a few of the items from #99, not all but the ones that would be the most useful.
- The idea of the empty pattern,
! something that will never match anything.
- Extend the use of the
& operator to be used for pattern set intersections: 1..5 & 3..8 is the range 3..5. If the patterns do not have any intersection then you get the ! pattern.
- Specify in the pattern specification that
pat | pat -> pat no matter the location. This basically means that the | operator is used with patterns as a pattern set union operator. The requirement is that the patterns must extend over the same type just like in match statements currently.
- Add pattern guards (pattern if condition) to patterns properly. Once again, this would make the pattern syntax consistent with that of match arms. It could also be useful within
let bindings: let ((a, _) if a > 5) | (_, a) = (e, f); would define a as the value of e if e > 5, and otherwise bind a to the value of f.
This is the initial issue to reopen a few of the items from #99, not all but the ones that would be the most useful.
!something that will never match anything.&operator to be used for pattern set intersections:1..5 & 3..8is the range3..5. If the patterns do not have any intersection then you get the!pattern.pat | pat -> patno matter the location. This basically means that the|operator is used with patterns as a pattern set union operator. The requirement is that the patterns must extend over the same type just like in match statements currently.letbindings:let ((a, _) if a > 5) | (_, a) = (e, f);would defineaas the value ofeife > 5, and otherwise bindato the value off.