Document and propose alternatives to confusing uses of tuples in control flow with pattern matching.
Quick example:
(i, j, k) match {
case (true, 1, "value") => // Do one thing.
case (_, 2, "value") => // Do another.
}
This can start simple but doesn't scale:
(i, j, k, x, y, z) match {
case (true, 1, "value", _, _, _) =>
// Do one thing.
case (_, 2, "value", _, _, _) =>
// Do another.
case (true, _, _, true, 3, "value") =>
// Original arguments are relevant, but not all.
case _ =>
// Give up; I can't possibly understand all cases, but "this should never happen" gets utter.
???
}
This is another clear case where ADTs help in reducing the state space.
Document and propose alternatives to confusing uses of tuples in control flow with pattern matching.
Quick example:
This can start simple but doesn't scale:
This is another clear case where ADTs help in reducing the state space.