julia
julia copied to clipboard
Correctly mark all symbols as `public` or not
#50105 added a preliminary list of symbols to be marked as public from Base. We should finalize that list for Base, stdlibs, and submodules before 1.11.
### Tasks
- [x] Base
- [ ] Submodules of Base
- [ ] Stdlibs
- [ ] A final review to make sure we're not marking anything as pubic that we don't want to
is this issue solved or can i help?
This issue is very much not solved, and we would appreciate your help!
Any symbol that is mentioned in the manual in Julia 1.9 or 1.10 and is not exported should be marked as public with public that_symbol. If you want to help, you can look through submodules of Base and/or standard libraries to find these symbols and mark them as public. Ideally, you would find many symbols and mark them all as public in a single PR so discussion can be more effective. In some cases it might not be clear whether or not a symbol is supposed to be public, feel free to take a guess and mention that you are unsure and other folks can weigh in with their opinions.
Can you explain me bit more specifically about how should i approach this.
You could install Julia 1.11 (download the nightly or build from source) and then run names(Base.Iterators, all=true) or using Random; names(Random, all = true) or the same for any module. That will give a list of symbols. If you then run names(Base.iterators), that will give a list of public symbols. If you find things in the longer list that are explicitly mentioned the online manual, then they should probably also be in the shorter list and you can open a PR to mark them as public.
so should i download all the dependencies for building julia or can i just clone it in my local machine and run for this task
Ideally, this should work:
$ git clone https://github.com/JuliaLang/julia
$ cd julia
$ make
... wait a long time ...
$ ./julia
If you try this and get an error and you are running on a mainstream OS, let us know, because that's probably a bug on our end.
make doesnt work for windows
Ah, right. Windows. The steps for building from source are a bit more complicated: https://docs.julialang.org/en/v1/devdocs/build/windows/#Source-distribution
You don't have to build from source to contribute, but it can be very helpful in testing your PRs.
Base.include is documented in the manual and referred to from other help sections, so it seems like it's part of the public interface. The REPL help, however, says: "The following bindings may be internal; [...]"
How is this possible lol
julia> Base.include === include
false
Every module has an include function that is private to that module
Base.include and Base.MainInclude.include are two different functions, both documented. The latter is the one exported from Base:
julia> Base.MainInclude.include === include === Main.include
true
What about Stdlibs?
Take SHA.jl as an example.
All symbols list in docs are exported, so there is nothing to do, right?
docs HTML: https://docs.julialang.org/en/v1/stdlib/SHA/ docs md: https://github.com/JuliaCrypto/SHA.jl/blob/88e1c83c32790c1cfbd0d13cc71c7db32bd6a573/docs/src/index.md?plain=1#L61 export: https://github.com/JuliaCrypto/SHA.jl/blob/88e1c83c32790c1cfbd0d13cc71c7db32bd6a573/src/SHA.jl#L36-L49
Do we need to change export to public or something else?
Do we need to change
exporttopublicor something else?
No need to do that, AFAIK: either one of public or export denote public API, the difference is just that public doesn't pollute namespaces (when imported with using instead of import).
Hello,
Is this issue solved, else I'd love to contribute. It is my first time contributing to open source, so any tips on how to go about it would help a ton.
Thanks
For the Tar stdlib, there are https://github.com/JuliaIO/Tar.jl/pull/174 and https://github.com/JuliaIO/Tar.jl/pull/175.
I'm looking at candidates in Base.Broadcast. Where should the corresponding public statement go? To broadcast.jl (following export?), to public.jl or elsewhere?
Xref #53900 for Base.Iterators.
For Base.Broadcast I believe they would go in https://github.com/JuliaLang/julia/blob/master/base/broadcast.jl
OK, the PR for Base.Broadcast is #54060.
I don't think this has to be on the milestone since adding a public can always be done in a later release.
It's just that users will start getting "this symbol may be internal" warnings for docstrings of nonpublic symbols in 1.11
I don't think this has to be on the milestone since adding a
publiccan always be done in a later release.
I'm not a fan of this, because that means a symbol could be public on 1.10 (because it's in the manual), private on 1.11 (because it's not declared with public), and then public again on 1.12 (because it gets declared with public later on). We should be encouraging less usage of private symbols, not more. Anything on 1.11 that is not declared with export or public is officially private.
In fact, making a public symbol private is a breaking change according to SemVer, so this issue should block release of 1.11. (EDIT: I guess that's probably not quite true in Julia, since making a symbol private in Julia does not break any code.)
There are some modules that are declared public:
public
# Modules
Checked,
Filesystem,
Order,
Sort,
I think the Iterators and ScopedValues modules should probably be added to that list. (I think ScopedValues is in the 1.11 release, right?)
Iterators
Iterators is already public by way of export
julia> Iterators
Base.Iterators
julia> Base.ispublic(Base, :Iterators)
true
julia> VERSION
v"1.11.0-beta1"
ScopedValues
Either that module should be public or Base should re-publicize its exports. I prefer the former, slightly.
Iterators is already public by way of export
Ah, I see, thanks.
ScopedValuesEither that module should be public or Base should re-publicize its exports. I prefer the former, slightly.
Yeah, I think the ScopedValues module should be made "public" (as opposed to public) by being added to the export list for Base (along with Iterators, Threads, Sys, etc).
Base.literal_pow should also be marked as public: see https://github.com/JuliaLang/julia/issues/55194 for details (that issue is closed while not a full duplicate imo).