A suggestion for modules names / sharing code between projects

ag0aep6g via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 29 11:20:23 PST 2016


On 29.02.2016 20:03, Sebastien Alaiwan wrote:
> $ find projectA
> ./projectA/internal/math/algo.d
> ./projectA/internal/math/lcp.d
> ./projectA/internal/math/optimize.d
> ./projectA/gui/main.d
>
> $ find projectB
> ./projectB/app/render/gfx.d
> ./projectB/app/render/algo.d
> ./projectB/app/physics/math/algo.d
> ./projectB/app/physics/math/lcp.d
> ./projectB/app/physics/math/optimize.d
> ./projectB/main.d
>
> The directory "math" is shared between projects. It actually is an
> external/submodule. So it has a standalone existence as a library, and
> might one day be used by projectC.
> (In the context of this issue, I'm using separate compilation).
[...]
> Clearly, putting everyone back into the same "file namespace" by adding
> every subdirectory of my project as import paths through the command
> line is not going to scale.

How is not going to scale? You have to add an import path for every 
location where packages are to be found. How many such locations are you 
going to have that this is unreasonable?

With your example, you'd have -Iinternal in project A, and -Iapp/physics 
in project B. The module declaration would of course be `module 
math.optimize;`.



More information about the Digitalmars-d mailing list