-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
proposal: remove pub
from the language
#21503
Comments
i've sometimes wanted handles to private functions, but if i recall any of those moments, they are all trying do something i should not have. in the rare case it does, just mark it a more objective reason this is a bad idea is to do with imports, as they are just decls initialized with const std = @import("std");
test {
_ = std.posix.windows.mem.indexOfScalar(u8, "hello", 'l');
} this makes it more confusing to find the public API manually, and impossible for tooling such as autodoc, zls, and future software to know what is an import and what is an intentional part of the api. that's what |
This could be fixed by requiring that "pub" fns only reference types in their arguments and return value that are also public, like rust does. That way if a function is public and it returns Utf8DecodeError!u21, Utf8DecodeError would have to be made public too. |
Please do not file a proposal to change the language |
edit: I now disagree with this proposal as I now realize (after using the language a lot more) that pub is actually quite useful for documentation.
The text was updated successfully, but these errors were encountered: