The reverse domain notation is used by companies to name their Java packages.
So I’m wondering if this would also be practical for Julia projects?
Imagine an organisation has a domain called mycompany.org and you want to create a new project called MyProject2019 and MyProject2020 . In java you would do this with namespaces like org.mycompany.MyProject2019 and org.mycompany.MyProject2020 (directory: org/mycompany/MyProject2020/).
If you try this with modules and submodules in your julia project, you will have to name your root module “org”. This leads to an problem If your package is used by other companies. Other companies can not define “org” themselves because it already exists (and yes i know you will just get an “WARNING: replacing module” message…, don’t do this).
Wouldn’t it be wiser to replace the dot with an underscore instead and use the full domain as module name? (org_mycompany_MyProject2019 -> No submodule tricks needed!).
I also found out that dot notation in module names can work. I did this with a macro and eval, but would this likely be considered bad practice?
macro module_with_dot(name::String) sym=Symbol(name) :(@eval module $sym; println("It works!"); end) end
julia> @module_with_dot "org.mycompany.MyProject2019" # It works ?! It works! Main.org.mycompany.MyProject2019 julia> Main.org ERROR: UndefVarError: org not defined
It would be cool if julia could provide Reverse domain notation without the use of macros.