mir-core icon indicating copy to clipboard operation
mir-core copied to clipboard

provide `assertMatch`

Open FraMecca opened this issue 4 years ago • 1 comments

In D it is not possible to write:

value.match!((A a) => a, (_) =>assert(false))

instead of using trymatch or a nullable I think it would be useful to have an assertMatch that raises an exception when the type can't be handled. Possibly you can come up with a better name than assertMatch.

FraMecca avatar Feb 04 '21 18:02 FraMecca

@FraMecca what is the difference between tryMatch and assertMatch? tryMatch throws an exception too.

9il avatar Aug 16 '21 15:08 9il