On Sunday, 3 January 2016 at 15:46:55 UTC, tsbockman wrote:
How important is it to avoid circular dependencies in Phobos?

I'm wondering because I have divided my work-in-progress std.checkedint module into various submodules to make it easier for people to import only the part they actually want to use.

Splitting modules into a circular package retains *some* of the benefits of split modules, like the smaller namespace in importing modules: while the whole tree is recursively pulled in, the user chooses which symbols to make available in the importing module. In D we have a number of conflict resolution mechanisms, including selective imports, so I don't count this as particularly useful.

The real benefits come when the split modules form a clean, non-circular dependency graph. Then we get the good stuff like faster compile times and smaller executables, can be understood in chunks etc.

I'm personally not a fan of circular modules, but I don't have strong opinions about them. In Phobos we have a number of modules with poor granularity that could be split into clean dependency trees. I don't know what to do, if anything, about circular modules that *can't* reasonably be split up as such.

Reply via email to