If the collaboration is deeply entwined, the two modules should be one
module. If one module uses another, but with occasional callbacks in
the other direction, use an interface or a protocol to define the
backchannel.
Think about it from the point of view of someone wanting to call your
modules. What benefit are you providing them by offering two modules
separately, when neither one works at all without the other?
Stu
You know what? I am not sure that it smells so bad actually. What if I
have 2 modules that collaborate with each other and use each other
functions ? Why is this so bad?
On Jan 24, 5:32 pm, Laurent PETIT <laurent.pe...@gmail.com> wrote:
Short answer: you can't. And yes, it's a "smell" (a bad one) if you
want to achieve this.
You have to somehow break the cycle :
* maybe acknowledge that ns a & b are strongly coupled since there's
the need for a cyclic dependency, and merge them.
* sometimes one wants to have a & b to have things in different
files. You can just (load) one from the other to include its content
into the same namespace, but still have the namespace separated into
several files.
* maybe move the common parts of a and be into a third namespace c
* ...
Maybe if you give more info concerning your particular case, ...
HTH,
--
Laurent
2010/1/24 Gabi <bugspy...@gmail.com>:
This thing is driving me nuts. If I do a cyclic require(ns-a
requires
ns-b and ns-b requires ns-a) I get exceptions complaining about "No
such var->.."
How can cyclic dependencies be done correctly in Clojure ? I know it
might be bad practice. But I really need it.
--
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 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 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