Namespace for a module defined by its import path

Jeff Thompson via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 24 14:06:18 PDT 2016


I have different versions of a library module in different 
folders. For example

/version1/lib.d
/version2/lib.d

In my application I need to be able to update the names of the 
different folders without needing to change the module files. 
That means the file cannot contain "module version1.lib;" since I 
may need to change it to "versionA".

Ideally, I want to omit the "module" declaration in the library 
file, but still import it with the desired file path as "import 
version1.lib;".  And I would also want to "import version2.lib;" 
without conflict.

Basically, I want the namespace of the identifiers in the library 
module to be defined by the path which is use to load them 
*without needing to put the path in the module file.*  Is there 
some way to do this?


More information about the Digitalmars-d mailing list