One idea is to incorporate a single switch statement which subsumes the proposed match statement. To do this, it requires:
The switch covers all possible cases; or,
The switch has a default statement.
For finite types (e.g. union types), covering all possible cases is feasible. For others, such as int it is not and therefore a default case will always be required.
(see also #34)
An interesting dissection of
switch
statements in Java:https://blog.joda.org/2019/11/java-switch-4-wrongs-dont-make-right.html
One idea is to incorporate a single switch statement which subsumes the proposed
match
statement. To do this, it requires:switch
covers all possible cases; or,switch
has adefault
statement.For finite types (e.g. union types), covering all possible cases is feasible. For others, such as
int
it is not and therefore adefault
case will always be required.