Step 3: no need for modules/namespaces
But my guess is that you never really wanted to create sub-modules d, e, & f.
Given that you were trying to do using .d:f
from module A, my guess is that you really are just using separate files to break up your software into a more manageable solution:
Awesome; keep doing that . It’s much easier to find code if you split up large solution into separate files.
But that means you can stick with a simpler structure:
A.jl
module A
include("d.jl")
include("e.jl")
include("f.jl")
end
Yup. That’s it. Now, all the code from d.jl, e.jl, and f.jl are now part of module A.
very_long_function_names_to_avoid_name_collisions
If you don’t need to split things into submodules - don’t. In julia, I find there is rarely a reason to do so.
In most languages, you need namespaces to avoid creating very_long_function_names_to_avoid_name_collisions
- but that isn’t typically necessary in Julia.
Leverage multiple dispatch
…instead of relying on namespaces.
If you want to create a method of push!()
that behaves differently for your values, you simply create your own struct MyType
, and define a special Base.push!(::MyType, ...)
method - and it automatically plays nice with the rest of Julia. The same can be done with any other function.