This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-17
Channels
- # announcements (24)
- # babashka (22)
- # beginners (49)
- # cider (16)
- # clj-kondo (8)
- # cljsrn (4)
- # clojure (87)
- # clojure-australia (7)
- # clojure-europe (44)
- # clojure-nl (4)
- # clojure-sweden (7)
- # clojure-uk (24)
- # clojurescript (5)
- # core-async (7)
- # cryogen (8)
- # cursive (22)
- # data-oriented-programming (2)
- # datomic (1)
- # emacs (6)
- # events (4)
- # fulcro (11)
- # google-cloud (1)
- # introduce-yourself (1)
- # java (8)
- # jobs (3)
- # lsp (10)
- # observability (1)
- # off-topic (12)
- # polylith (12)
- # re-frame (6)
- # reitit (36)
- # remote-jobs (1)
- # ring (4)
- # ring-swagger (1)
- # rum (4)
- # schema (1)
- # shadow-cljs (18)
- # sql (56)
- # tools-deps (33)
Is cider supposed to evaluate depending namespaces? E.g. I have foo.core
which contains protocols and foo.impl
with implementations of the protocols.
When I c-c c-k
(eval buffer) in the foo.core
buffer and re-run code in the REPL that uses foo.impl
I get the type of exceptions that show foo.impl
is stale and I need to re-evaluate it
with cider-ns-refresh, which is a wrapper for tools.namespace or reload dependent namespaces by hand, some people swear by it
can you explain a bit more of what you are doing? It sounds like you edited foo.impl
, then reload foo.core
and want to see the updated behavior of foo.impl
? Is that correct?
@U45T93RA6 I don’t see how it’s supposed to solve my problem? plus, I’ve found it to mess up the repl if used too often
@U11BV7MTK let me fix my explanation:
1. with existing and evaluated foo.impl
edit foo.core
2. eval foo.core
3. re-run code in repl
4. get error
No implementation of method: :apply-reaction of protocol:
#'ffr.core/Reaction found for class: ffr.reactions.Targets
so core
contains a defprotocol, and impl
defrecords?
if you change core, save, then cider-ns-refresh, it will reload core and impl, preventing errors related to staleness
not super sure with cider-ns-refresh, personally I use tools.namespace directly, which does
my unknown is whether cider-ns-refresh saves, should be easy to check but it's certainly needed, because it uses this external lib called tools.namespace
generally it works but it can not work like 1% of the time, unless you take some explicit measures see also https://clojurians.slack.com/archives/C03S1KBA2/p1642439762134300?thread_ts=1642430221.125500&cid=C03S1KBA2
I think metadata is looked up last, so this is the slowest performing option. I’d rather switch and re-eval, but thanks
also protocols generally represent IO work, so dispatch overhead will be negligible compared to said IO costs
Updating to cider-20220113.610 I found I was getting a version mismatch "WARNING: CIDER 1.3.0-snapshot requires cider-nrepl 0.28.0, but you're currently using cider-nrepl 0.27.4.". I got around it by (setq cider-jack-in-lein-plugins '(("cider/cider-nrepl" "0.28.0")))
which seems odd because the project where I started has a deps.edn and no project.clj.