Skip to content

add default to enum switches #147

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TechnikTil
Copy link

This PR adds a default to all Expr switches, so that libraries that try to add an extra enum entry with macros don't run into errors.

@Simn
Copy link
Member

Simn commented Jul 7, 2025

I don't agree with this. The whole purpose of exhaustiveness checks in pattern matching is to ensure that all cases are handled. We lose that functionality by adding a default case everywhere.

@TechnikTil
Copy link
Author

TechnikTil commented Jul 7, 2025

I don't agree with this. The whole purpose of exhaustiveness checks in pattern matching is to ensure that all cases are handled. We lose that functionality by adding a default case everywhere.

Fair
would a throw be better?

@Kriptel
Copy link
Contributor

Kriptel commented Jul 7, 2025

I think that for correct work it is necessary to add compilation conditions.

example:

#if extra_exprs
default:
#end

@TechnikTil
Copy link
Author

TechnikTil commented Jul 7, 2025

I think that for correct work it is necessary to add compilation conditions.

example:

#if extra_exprs
default:
#end

sure, let me do that

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

Successfully merging this pull request may close these issues.

3 participants