I'm not completely sure about why this happens like it does, but jotting down my thoughts so maybe we can figure it out together.
Some background:
- When Calva connects to a ClojureScript REPL it will first connect to the Clojure REPL and establish an nREPL session. Then it clones this session and ”promotes” the clone to a ClojureScript nREPL session. Note that we now have two CLJ sessions:
CLJ1 while be used for Clojure files, and CLJ2 (promoted to CLJS) will be used or ClojureScript files.
- Calva also has a
CLJC session ”pointer” which will point to CLJ1 by. default. (This pointer can be toggled by the user by clicking the cljc/clj button in the statusbar.)
When you load example.cljc it will compile the macro in CLJ1. Then when you load core.cljs it will compile the macro using CLJ2. Then you update the file and recompile the macro in CLJ1 by loading example.cljc. Then you load core.cljs which doesn't seem to recompile the macro. I don't know why.
I tried this: I toggled the CLJC pointer to be cljc/cljs and then I get the expected results loading files in the order
example.cljc (recompiles the macro using CLJ2)
core.cljs
But if I load core.cljs first the recompile doesn't happen.
So, maybe it is generally the case that loading a .cljs file does not trigger a recompile of macros... This could be a Calva bug, but I don't recall any code in Calva that cares about wether a file is .cljc or .cljs. It just has this mapping of file-extension -> nrepl-session and sends the nREPL op to the session it picks up.
I'll investigate it a bit further and see what I can figure out.
I'm not completely sure about why this happens like it does, but jotting down my thoughts so maybe we can figure it out together.
Some background:
CLJ1while be used for Clojure files, andCLJ2(promoted toCLJS) will be used or ClojureScript files.CLJCsession ”pointer” which will point toCLJ1by. default. (This pointer can be toggled by the user by clicking thecljc/cljbutton in the statusbar.)When you load
example.cljcit will compile the macro inCLJ1. Then when you loadcore.cljsit will compile the macro usingCLJ2. Then you update the file and recompile the macro inCLJ1by loadingexample.cljc. Then you loadcore.cljswhich doesn't seem to recompile the macro. I don't know why.I tried this: I toggled the
CLJCpointer to becljc/cljsand then I get the expected results loading files in the orderexample.cljc(recompiles the macro usingCLJ2)core.cljsBut if I load
core.cljsfirst the recompile doesn't happen.So, maybe it is generally the case that loading a
.cljsfile does not trigger a recompile of macros... This could be a Calva bug, but I don't recall any code in Calva that cares about wether a file is.cljcor.cljs. It just has this mapping offile-extension -> nrepl-sessionand sends the nREPL op to the session it picks up.I'll investigate it a bit further and see what I can figure out.