The following seems like it could be a common scenario when attempting to re-write parts of an existing Java application in Clojure. Let's say there exists Clojure code and Java code in the same project. The Clojure code depends on the Java code in one direction and then the same is true in the opposite direction. Given that compiling Java and Clojure require separate and different compilation steps, how would circular dependencies be resolved ? e.g. A class is defined in the Clojure code that references Java classes(yet to be compiled) and the same is true for the Java code referencing classes defined in Clojure(yet to be compiled). It doesn't seem like compiling one before the other would solve this issue.<p>There was a short discussion in the Clojure group(which didn't seem to gain much traction).<p>http://groups.google.com/group/clojure/browse_thread/thread/84bd18b3ceeae0e8/95bd40d25290c167?lnk=gst&q=circular#95bd40d25290c167<p>Does anyone here have some good ideas ?
<a href="http://www.codecommit.com/blog/scala/joint-compilation-of-scala-and-java-sources" rel="nofollow">http://www.codecommit.com/blog/scala/joint-compilation-of-sc...</a><p>Above is an overview of how the Scala compiler attacks this exact problem. Long story short: It is able to grok just enough Java to build a basic AST and resolve circular dependencies the same way it handles one in pure Scala.<p>The article also hints that Groovy has similar capabilities.