Hey! I'm developing the clojure-repl-intellij plugin, and have a question about the behavior of the cider-nrepl https://docs.cider.mx/cider-nrepl/nrepl-api/ops.html#refresh op.
I have two files foo.clj and baz.clj (https://github.com/afucher/clojure-sample/tree/test-refresh-ns)
;;foo.clj
(defn some-function []
"-foo")
;;baz.clj
(defn baz []
(clojure-sample.foo/some-function))
(baz)
(clojure-sample.foo/some-function)
If I change the some-function to return -foz , call the op refresh and try to eval the function baz it returns the old value (`-foo`) but calling directly the function returns the new value
(baz) ;;=> "-foo"
(clojure-sample.foo/some-function) ;;=> "-foz"
If I evaluate the definition of baz or evaluate some-function again or load foo.clj file, it works. The behavior just happens after using the refresh op.
Don't know if is some cache, or something related to var .
Also, it was reproduced on emacs by @ericdalloI haven’t looked at this part of the code in a while, but I recall it was a very thin wrapper around c.t.n/refresh (that’s where the name of the middleware and the op is coming from) https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/refresh.clj#L83 @arthurfucher can you file a ticket on cider-nrepl’s tracker and I’ll take a closer look.
This probably needs to be checked more carefully as well https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/refresh.clj#L19
@bozhidar issue created: https://github.com/clojure-emacs/cider-nrepl/issues/918 Let me know if I can help with anything
@bozhidar any idea? We tested Cursive and saw it works but I think it does in its own custom way, not using refresh ops