A suggestion for modules names / sharing code between projects

Sebastien Alaiwan via Digitalmars-d digitalmars-d at puremagic.com
Thu Mar 3 11:00:22 PST 2016


On Thursday, 3 March 2016 at 08:39:51 UTC, Laeeth Isharc wrote:
> On Thursday, 3 March 2016 at 06:53:33 UTC, Sebastien Alaiwan
>> If, unfortunately, I happen to run into a conflict, i.e my 
>> project uses two unrelated libraries sharing a name for their 
>> top-level namespace, there's no way out for me, right?
>> (Except relying on shared objects to isolate symbols)
>
> See modules doc page off dlang.org.
> import io = std.stdio;
> void main()
> { io.writeln("hello!"); // ok, calls std.stdio.writeln
> std.stdio.writeln("hello!"); // error, std is undefined
> writeln("hello!"); // error, writeln is undefined
> }
Thansk, but I was talking about module name collisions, e.g if my 
project uses two unrelated libraries, both - sloppily - defining 
a module called "geom.utils".

Can this be worked-around using renamed imports?

How is "import myUtils = geom.utils" going to know which of both 
"geom.utils" I'm talking about?
As far as I understand, _module_ renaming at import is rather a 
tool for defining shorthands, than for disambiguation.

I agree that it might not be a problem in practice - just wanting 
to make sure I'm not missing something.



More information about the Digitalmars-d mailing list