Hi all, I'm a little confused about circular namespace dependencies and what is allowed and not allowed. My understanding was that Clojure did not permit cycles in the namespace dependency graph. I dimly recall seeing an error about this at some point and I had seen code in e.g. tools.namespace which throws an error on dependency cycles, so I added some validation in Cursive to produce an error and to prevent namespaces being loaded when there were cycles.
The initial implementation would throw an error if there was a cycle anywhere in the transitive closure of all dependencies from a namespace. This was clearly a little too enthusiastic and has now been fixed, but it did reveal several libraries which have obvious circular dependencies with no apparent issues. One example of this is Zach Tellman's Manifold library, which contains a central manifold.stream namespace which is required by several manifold.stream.<whatever> namespaces. However manifold.stream requires them back with bare require's halfway through its source, and Cursive would complain about this. So, I'm confused. I'm not sure what is allowed and under what circumstances, and I'm not sure what I should be validating here. Zach very reasonably argued that Clojure clearly permits this since Manifold works, but I'm not sure if this is just a happy accident. Looking at the clojure.core code, it seems that there is only circular dependency checking when using load, not when using require. tools.namespace does throw an error on circular dependencies but wouldn't catch this because it only looks at the ns form, not at any later requires. Any clarity on what is actually allowed, and any suggestions about the right thing to be validating here are much appreciated. Cheers, Colin -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.