On Thu, Mar 1, 2012 at 8:33 PM, Cymen Vig cymen...@gmail.com wrote:
I attempted to do something like this:
(ns parent)
(defmulti my-method (fn [x] (:method x))
(ns child1)
(defmethod my-method :zzz
...)
(ns child2)
(defmethod my-method :aaa
...)
However the problem is the
I built a modeling system that uses the multi-method namespace separation
you are talking about. The solution that I use simply leverages the
difference between require, use, and refer. In each namespace that
implements the multi-method, put (refer 'parent) after the ns form. In the
parent
On Friday, March 2, 2012 7:03:10 AM UTC-6, tim.visher wrote:
I will not in any way claim to know how or why this works. I'm just
starting to use multimethods myself, but I'll give you my set up that
appears to be working at the moment.
I have a namespace:
(ns store.store)
I use a lot of multimethods with my framework, Ciste[0] and it can work,
the only thing is you have to be very careful about what you put where,
and it helps to have a lot of namespaces.
What I do is try to keep all of my defmulti's in one namespace and have
only defmethod's in another namespace.
I attempted to do something like this:
(ns parent)
(defmulti my-method (fn [x] (:method x))
(ns child1)
(defmethod my-method :zzz
...)
(ns child2)
(defmethod my-method :aaa
...)
However the problem is the children need to use the parent namespace in
order to have the method definition and