Welcome! Please see the About page for a little more info on how this works.

0 votes
in Multimethods by

Whenever methods on a multifn need to be installed within a closure (usually to support lifecycle management) using defmethod can be a bit cumbersome and forces having all
method bodies within the closure.

Two cases strike me as most relevant:

If you need a method to capture bindings, it would involve creating a bound-fn and calling that from the defmethod.

With dependency injection framework, you most likely method installation when dependencies are available, making calling defmethod cumbersome.

I attached an example in foo.clj to try to make things clearer and a naive patch.

After discussing things on #clojure-dev with @alexmiller, it seems it would be feasible to add an add-method function and to have defmethod use that.

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2514 (reported by admin)
...