Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide assertMatch #39

Open
FraMecca opened this issue Feb 4, 2021 · 1 comment
Open

provide assertMatch #39

FraMecca opened this issue Feb 4, 2021 · 1 comment

Comments

@FraMecca
Copy link

FraMecca commented Feb 4, 2021

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.

@9il
Copy link
Member

9il commented Aug 16, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants