Namespace for a module defined by its import path
Jeff Thompson via Digitalmars-d
digitalmars-d at puremagic.com
Mon Oct 24 23:47:14 PDT 2016
On Tuesday, 25 October 2016 at 00:42:59 UTC, Adam D. Ruppe wrote:
> On Monday, 24 October 2016 at 21:06:18 UTC, Jeff Thompson wrote:
>> 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?
>
> That's not going to work... but why do you want this? If they
> are different versions of the file, editing the module
> definition should be no real problem. You can use renamed
> imports or a helper module with public import to keep user code
> more compatible.
A variant of this is where the version name is the Git commit
hash. Instead of "version1" and "version2" it is:
/commit_b3bf5c7725c98ee3e49dfc4e47318162f138fe94/lib.d
/commit_df0741a84c8a967ea08674090afdff4e9a58d23e/lib.d
The file lib.d can't contain its own commit hash, so I can't put
it in the module declaration. And different parts of the
application rely on different versions so I need different
application files to be able to import one or the other without
conflict. I'm trying to escape the situation where a piece of
code needs to know the path which the operating system uses to
load it.
More information about the Digitalmars-d
mailing list