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

Use package to annotate types intead of comments. #7

Open
egonelbre opened this issue Dec 6, 2019 · 1 comment
Open

Use package to annotate types intead of comments. #7

egonelbre opened this issue Dec 6, 2019 · 1 comment

Comments

@egonelbre
Copy link
Member

Instead of using comments to annotate types, use either function calls or stub interfaces.

Either of these could work:

type Letter byte

var _ enum.Exhaustive = Letter(0)
type Letter byte

var _ = enum.Exhaustive(Letter(0))

This would allow to specify the different options more nicely or suppressing the error messages.

@egonelbre
Copy link
Member Author

For exceptions to the default behavior in switches:

switch enum.Exhaustive(xyz); xyz {

For exceptions to the default behavior in func declarations:

func Example(xyz Value) {
    enum.Exhaustive(xyz)
}

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

1 participant