On Sunday 15 June 2014 15:13:55 Peter Dimov wrote:
John Maddock wrote:
IMO we need a better way of looking at dependencies, perhaps by marking up glue headers as optional.
This approach causes difficulties down the road.
module X X.hpp
module Y Y1.hpp Y2.hpp (optional) includes X.hpp
module Z Z.hpp includes Y2.hpp
Does Z depend, indirectly, on X?
Yes, how could it be otherwise.
If your answer is yes, and it must be, remember that Y does not depend on X, so the secondary dependencies are no longer the transitive closure of the primary dependencies.
It's not the question of Y depending on X anymore. If Y is header-only, it's a question of Y2.hpp (from Y) depending on X.hpp (from X). If Y is not header-only, the dependencies should include all dependencies of the compiled part. Arguably, Y2.hpp may not require the compiled part, but that case could also be handled by a metadata flag.
The tool can be made to figure these things out, but to do so, it will need to create virtual submodules, one per each optional header.
Either that, or scrap the whole module-level dependency approach and start tracking individual headers.
I'm for tracking headers. Submodules just impose too much difficulties to use them on header level. Maintaining libraries should be fun.