Excessive namespace using @reexport


I’m writing a module that makes use of the Distributions package. Its API has arguments that are Distribution types. So in order to be used in another environment, it is practically mandatory that the Distributions package is loaded too.

So what I did was to add a @reexport using Distributions at the beginning of my module to ensure the user have all it needs when it loads my package with using MyPackage.

Is this a good practice ? I’m asking because it’s crowding the namespace of MyPackage with all the exported names of Distributions, most of which are useless. And I’m kind of suspecting that this is not the intended use of Reexport, that it’s rather made for sub-modules.

If it’s not, what’s the advised way to go then ?

1 Like

Do you also have functions which do not need Distributions at all? I guess it depends a bit on the expected use-case. I would personally try to limit the cluttering on the namespace as much as possible, but also know that others don’t see it as an issue.

Yes, most of them actually. Basically Distributions are needed in the constructors of the structs provided by the package, but once they are instantiated, you interact with them without the need for Doistributions anymore.

I would not reexport anything, and just document that users should be

using Distributions, MyPackage
1 Like