I would try to stay away from any nested def's in components (but also in
other functions). I'm using component a lot and I never had the need for
this.

Maybe you can elaborate on why you think you need a multimethod inside the
component? Maybe a full example?

Cheers,
Jeroen



On Wed, Feb 25, 2015 at 12:08 PM, Colin Yates <[email protected]> wrote:

> Hi,
>
> I have a number of commands flying around which need to be handled.
> defmulti/defmethod seem a nice answer. The problem is that each command
> handler will need different collaborators (those with long memories will
> realise this isn't new ground here ;)).
>
> I want to do something like:
>
> (ns one)
> (defmulti handle first)
>
> (ns two)
> (defrecord CommandAHandler [collab-1 collab-2]
>   component/Lifecycle
>   (start [this]
>     (defmethod handle :command-a ....
>       (collab-1 ...)))
>
> I realise that the lifecycle of defmethod doesn't match the component
> (i.e. stopping can't unregister the defmethod), but my main reservation is
> that a nested defmethod feels a bit weird. Has anyone done anything like
> this before?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected].
> 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 [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to