Fork me on GitHub

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


I need to save?


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


ns-refresh does not do the job unfortunately, I get the same error


generally it works but it can not work like 1% of the time, unless you take some explicit measures see also;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


it's not looked up last, it's in the middle of the check chain


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.


maybe you have cider-nrepl in your deps.edn which would need updating as well? but yeah IIRC there's some internal conflation between lein and deps.edn