What does the new "public" keyword actually do?

It affects names(module), which now includes by default identifiers that are non-exported but marked public.

So, basically, it gives an automated way to list the API of a module that is intended to be documented and non-private, whether or not it is exported into your namespace by using.

There is also a new Docs.undocumented_names(module) function that can be used in testing to check whether there are any names that are “public” (including exported symbols) that don’t have a docstring, i.e. with @test isempty(Docs.undocumented_names(MyModule)).

(In the future, one could imagine QA tools that check whether a package uses any non-public symbols from another package.)

13 Likes