Open darkleaf opened 5 years ago
Related: #52
It looks like ClojureScript stores the individual bits of a multimethod in atoms rather than the entire multimethod itself
I need to think about how we could do something like this without affecting programmatic/functional multimethod manipulation -- if you do something like this:
(m/defmulti mf ...)
(let [mf2 (m/add-primary-method mf ...)]
...)
mf2
should not affect mf
at all -- sort of like how assoc
doesn't mutate the original map. If we used atom(s) everywhere it would bust things (unless add-primary-method
copied the existing atom(s) into new atom(s)... maybe that would work).
I think either way we can get away with storing the entire impl
in a single atom rather than having several atoms.
ClojureScript has a stripped-down implementation of vars and does not have the
alter-var-root!
function.How to store multifn in atom like clojurescript does? https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/core.cljc#L2768
Or maybe just use mutable field?
For clojurescript support #20