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

public keyword for variants #8

Open
Roger-luo opened this issue Aug 10, 2024 · 2 comments
Open

public keyword for variants #8

Roger-luo opened this issue Aug 10, 2024 · 2 comments
Labels
decision design decision to be made

Comments

@Roger-luo
Copy link
Owner

Currently, we mark all variants in the namespace as public in 1.11+. Because if the GADT module is being marked public what's inside the module should be treated as public, because they are as a whole. But maybe there would be use case only part of the variants are public?

Please comment on this issue so we can collect such a use case.

@Roger-luo Roger-luo added the decision design decision to be made label Aug 10, 2024
@nandoconde
Copy link
Contributor

nandoconde commented Sep 5, 2024

Just to add info to the conversation, in Rust all variants are made public by default when the Enum is made public:

In contrast, if we make an enum public, all of its variants are then public.

Enums aren’t very useful unless their variants are public; it would be annoying to have to annotate all enum variants with pub in every case, so the default for enum variants is to be public.

Source: https://doc.rust-lang.org/book/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.html#making-structs-and-enums-public

@Roger-luo
Copy link
Owner Author

I see. This makes sense, then I did the right thing without thinking it I guess lol

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

No branches or pull requests

2 participants