I'm working on some Clojure code that has some circular dependencies between different namespaces and I'm trying to work out the best way of resolving them.
- Basic issue is that I get a "No such var: namepace/functionname" error in one of the files
- I tried to "declare" the function but then it complains with: "Can't refer to a qualified var that doesn't exist"
- I could of course refactor the entire codebase but that seems impractical to do every time you have a dependency to resolve..... and might get very ugly for certain networks of circular dependencies
- I could separate out a bunch of interfaces / protocols / declarations into a separate file and have everything refer to that.... but that seems like it would end up getting messy and spoil the current nice modular structure that I have with related functionality grouped together
Any thoughts? What is the best way to handle this kind of circular dependency in Clojure?