digitalmars.D.learn - Cyclic dependency between module A and B
- kdevel (10/10) Apr 10 2019 Recently (before refactoring) my application complained right
- Steven Schveighoffer (9/20) Apr 11 2019 Unfortunately not, because D supports separate compilation, and
Recently (before refactoring) my application complained right after invocation: object.Error src/rt/minfo.d(371): Cyclic dependency between module Filebrowser and App Filebrowser* -> App* -> Filebrowser* Is it possible to detect this dependency before the program is started? Perhaps during linking?
Apr 10 2019
On 4/10/19 2:52 PM, kdevel wrote:Recently (before refactoring) my application complained right after invocation: object.Error src/rt/minfo.d(371): Cyclic dependency between module Filebrowser and App Filebrowser* -> App* -> Filebrowser* Is it possible to detect this dependency before the program is started? Perhaps during linking?Unfortunately not, because D supports separate compilation, and interface files (.di files). So the compiler can't necessarily know at compile time that there is a cycle. The suckiest part is that once it's compiled, and doesn't detect a cycle, it's never going to have a cycle -- yet we run the algorithm to detect it on every start up (we actually have to in order to properly sort the static ctors). I'd love to get rid of that penalty. -Steve
Apr 11 2019