-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.
Milestone
Description
Now that you can't really put pub at the top-level of things like impl/extern/trait, you don't need the priv keyword to control method visibility of various items because they're all private by default.
pros:
- I think that this would really simplify public/private because there's one and only one rule: private by default, public if you flag it
- one less keyword!
difficulties:
- Right now this is the only way to make struct fields private. I personally believe that private-by-default for struct fields isn't that bad of an idea, and if this were the only thing blocking removing
privI'd vote to remove it.
cons:
- Enum variants can currently be tagged as
priv, and if we removed priv there would be no way to make half the enum variants public and half private. In theorypub enummakes everything public and you could otherwise writepubon each variant, but the type name would still then have to be public and if it didn't havepubin front of it it wouldn't really make sense - Private-by-default for structs is kind of annoying sometimes.
What do others think about this?
Metadata
Metadata
Assignees
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.