On Thu, Dec 13, 2012 at 1:31 PM, Timo Mihaljov <t...@mihaljov.info> 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

Reply via email to