This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-07
Channels
- # announcements (2)
- # babashka (24)
- # beginners (15)
- # calva (27)
- # clara (3)
- # clj-kondo (6)
- # cljs-dev (2)
- # clojure (83)
- # clojure-dev (35)
- # clojure-europe (82)
- # clojure-germany (2)
- # clojure-greece (1)
- # clojure-nl (5)
- # clojure-spec (52)
- # clojure-uk (14)
- # clojurescript (43)
- # conjure (16)
- # cursive (29)
- # data-science (1)
- # datalog (5)
- # datomic (1)
- # deps-new (8)
- # depstar (4)
- # emacs (6)
- # events (1)
- # fulcro (24)
- # jobs (4)
- # malli (12)
- # off-topic (46)
- # rewrite-clj (14)
- # shadow-cljs (53)
- # spacemacs (8)
- # specter (2)
- # sql (21)
- # tools-deps (62)
- # vrac (1)
- # xtdb (2)
Happy Monday! 🙂
morning
¡måning!
Well today I learnt something new. You can redefine a defmethod
. I always thought you couldn't as I understood multimethods were cached and un-redefinable.
You can redefine them if you use clojure.tools.namespace’s refresh / clear etc.
Also you can also do so manually by just (def mymulti nil)
then re-eval the defmulti and defmethods you want.
Also remove-method
and remove-all-methods
But, if I understand now, it's the dispatch function that cannot be changed. However, I see there is a little trick to use a reference to a function which does the dispatching, wihthin the defmulti
you can blat the defmulti
and redeclare it
but you cannot just redeclare overwrite it because there is a defonce
squirreled away inside, and it will just ignore you
Morning 👋