On Sunday, 26 March 2017 at 22:10:07 UTC, XavierAP wrote:
I was curious but I guess it's long to explain the different things that can go wrong if one doesn't declare module names.

You'll just get a name conflict eventually. Either two modules with the same name, or "module `foo` must be imported as `foo.bar`" errors when stuff fails to line up, then you'll need to go in and change all the imports to fix it. Real hassle to do later, real easy to do now.

Followup question: if I am inside module myproj.pack1.mod1 and want to import myproj.pack1.mod2... should I import myproj.pack1.mod2; or import mod2; ?

Always use the full module name in import. If you want to abbreviate it, do

module something = myproj.pack.mod2;

then you can refer to it as `something` throughout the usage points in that file.

Reply via email to