I've written a large application that uses this approach. You can see it applied with protocols and multimethods in types.clj and protocols.clj, and the remainder of the code in types/*.clj. I used this to manage over 10 different extensions, and it's been simple enough to keep organized.
I have used a few techniques to tie together all the disparate files. I have an approach for vars/fn from other namespaces, even if they're dynamic, and organization/readability in the face of a large API. You can find that here: https://github.com/dgrnbrg/piplin/tree/master/src/piplin On Thursday, December 13, 2012 4:43:48 PM UTC-5, puzzler wrote: > > On Thu, Dec 13, 2012 at 1:31 PM, Timo Mihaljov > <ti...@mihaljov.info<javascript:> > > wrote: > >> (ns example.patron >> "The patron doesn't have an artistic vision (that's the artist's job), >> nor does it know how to talk to a graphics API (that's what the canvases >> are for). What it *does* know is how many triangles and squares we can >> afford, and where we want them drawn." >> (:require [example.artist :refer [create-masterpiece] >> example.canvas :refer [make-canvas]])) >> >> (defn commision-a-masterpiece [] >> (create-masterpiece (make-canvas) 500 1000)) >> > > I like this idea of using multimethods to send information from the > concrete implementations back to the constructor in the core. > > But how do the concrete implementations ever get loaded? > > For example, if you start an empty repl and send the example.patron file > to the repl, none of the concrete implementations will get loaded, so > make-canvas will fail. Same thing if, for example, you made > commission-a-masterpiece into the "main" function and compiled the whole > thing into an executable jar. > > How do you get around this? > -- 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