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

Skip emptiness handling if type cannot be empty #30

Open
mknejp opened this issue Nov 13, 2021 · 0 comments
Open

Skip emptiness handling if type cannot be empty #30

mknejp opened this issue Nov 13, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@mknejp
Copy link
Owner

mknejp commented Nov 13, 2021

If a variant class has no default constructor and all other constructors initialize the _variant field to a non-default value then the variant cannot be empty. Under these circumstances the "empty" case is impossible to achieve and can be removed from the interface as these code paths will never execute.

Possible conflict: if constructors are later changed and the empty state becomes possible the previously safe methods could now throw InvalidOperationException. Maybe keeping the empty state is the safer option as it reminds the user of this eventuality. This needs investigating.

@mknejp mknejp added the enhancement New feature or request label Nov 13, 2021
@mknejp mknejp self-assigned this Nov 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant