April 10, 2019 Cyclic dependency between module A and B | ||||
---|---|---|---|---|
| ||||
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? |
April 11, 2019 Re: Cyclic dependency between module A and B | ||||
---|---|---|---|---|
| ||||
Posted in reply to kdevel | 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
|
Copyright © 1999-2021 by the D Language Foundation