fuzion
fuzion copied to clipboard
match multiple things at once? (to enhance readability)
currently
match a
av T =>
match b
bv T => T.equality av bv
nil => false
nil =>
match b
_ T => false
nil => true
could be sth like:
match a, b
av T, bv T => T.equality av bv
av T, nil => false
nil, T => false
nil, nil => true
``
If we did this, I would suggest that this is a form of destructuring, i.e., a, b should be a tuple (a, b) and match should support destructuring and pattern matching for the destructured elements, so the code would look like this:
match (a, b)
av T, bv T => T.equality av bv
av T, nil => false
nil, T => false
nil, nil => true
Some ideas on destructuring are in the design pages.