I like the idea of passing in the *key* of the external collaborator - that's nice. Thanks Stuart.
I am surprised there isn't more call for nested systems - maybe there is and this solution is sufficient-enough... Again - thanks Stuart! On 12 March 2015 at 15:16, Stuart Sierra <the.stuart.sie...@gmail.com> wrote: > On Wednesday, March 11, 2015, Colin Yates wrote: >> I can't merge the two systems because the reusable >> component is chocka full of very fine grained command >> handlers and both the internal and external systems will >> have their own 'bus' for example. I could namespace the >> keys but that again feels painful... > > That's exactly how I would do it. > > Nested systems don't really work. > > But one system can contain implicit "groups" of components. > > Create each group as a map, then `merge` them into the > system. > > Use namespaced keys to prevent clashes. > > The constructor functions for each component (or component > group) can take an argument which tells them the names of their > dependencies in the system. > > Pseudo example: > > (defn reusable-component [collaborator-key] > (component/using (map->ReusableComponent {}) > [:my/logger :my/bus collaborator-key])) > > (defn reusable-group [collaborator-key] > {:my/logger ... > :my/bus ... > :my/reusable-component > (reusable-component collaborator-key)}) > > (defn new-system [] > (merge (system-map :main/logger ... > :main/bus ... > :main/collaborator ...) > (reusable-group :main/collaborator))) > > > -S > > -- > 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. -- 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.