scenario: i want to use multimethods to dispatch and spread functionality across multiple files. one of the files contains only multimethods, and to make them usable i must manually load the file. is there a way to automatically load the file, rather than explicitly loading it?
here's a simple example of what i'm doing:
; app/core.clj
(ns app.core
(:use [app.fruit.core :only [make-fruit]])
(println (:name (make-fruit :banana)))
; app/fruit/core.clj
(ns app.fruit.core)
(defmulti make-fruit identity)
; app/fruit/banana.clj
(ns app.fruit.banana
(:use [app.fruit.core :only [make-fruit]])
(defmethod make-fruit :banana [fruit]
{:name "banana" :color "yellow})
fruit.banana's method aren't loaded unless i explicitly load it in app.core, like adding it to the :use group. this seems to defeat the purpose of using a multimethod since i still have to be explicit about all the methods implementing it.