Namespace for a module defined by its import path

Mike Parker via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 26 00:57:57 PDT 2016


On Wednesday, 26 October 2016 at 07:14:30 UTC, Jeff Thompson 
wrote:

>>
>> dmd 
>> -I/commit_b3bf5c7725c98ee3e49dfc4e47318162f138fe94/version/ 
>> main.d
>> dmd 
>> -I//commit_df0741a84c8a967ea08674090afdff4e9a58d23e/version/ 
>> main.d
>
> This will force the application to use either one version or 
> the other. As I said, it's a large application. I different 
> parts of the same application to be able to import the version 
> they need.

A module named foo.bar is foo.bar. There's no way to have a 
foo.bar version1 and a foo.bar version2 in the same program. You 
compile and link one version or the other, period. If you want 
multiple versions in the same program, then they need to have 
distinct module names:

foo/bar1.d --> module foo.bar1;
foo/bar2.d --> module foo.bar2;

I can't see how you would expect it to work otherwise. How would 
the compiler know that a call to foo.bar.someFunc belongs to one 
version or another if both have the same fully qualified name?

Or maybe I'm misunderstanding you (and I'm apparently not the 
only one in this thread). What problem are you trying to solve? 
Why do you need different versions of the same module or package 
at the same time in the same program?




More information about the Digitalmars-d mailing list