Hi,
I’m wondering how we can deal with cyclic dependencies in Daml. I’m trying to separate my templates and flows in multiple files but I end up having two templates referencing each other, which makes the compiler complain about cyclic dependency.
Is there a workaround?
Cheers,
Rafael
2 Likes
You can have cycling template dependencies, but only within a single module. So workaround 1 is to merge the modules.
But I think it would be even better to think about breaking the cycling dependency. I have often found that if I have a dependency A <-> B
, it makes sense to split this out into the “downstream” and “upstream” parts of the dependencies leading to four templates A_d, A_u, B_d, B_u
with dependencies
A_u -> A_d, B_d
B_u -> A_d, B_d
2 Likes
Thanks for the reply!
Are there plans to allow cyclic dependencies between modules in Daml?
Your second proposition is interesting, I’ll see whether I can break the modules further.
1 Like
There are no plans for cyclic module dependencies at this point.
1 Like