Supporting `add-method` on multi fns to install a function instead of a function tail

Description

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.

Environment

None

Assignee

Unassigned

Reporter

Alex Miller

Labels

Approval

Triaged

Patch

None

Priority

Major
Configure