A question: if I connect to nrepl and basically send the form: (do (ns new-ns) (pr-str (defn a-fun []))), what should be the result?
I thought it was going to be "#'new-ns/a-fun" (basically, a-fun gets created in new-ns) but it seems that the result is actually ""#'user/a-fun" (or whatever namespace the REPL was before). Is that right?
I just run that on my cider repl, and looking at the nrepl log looks like it return the expected thing "#'new-ns/a-fun"
Yeah, you're right. I found the offending code (I was wrapping around some stuff):
This fails for me: {:result (do (ns aaa-some-new-ns) (pr-str (defn a-fun [])))}
yeah, but that seems to be a Clojure thing:
$ clj
Clojure 1.11.1
user=> {:result (do (ns aaa-some-new-ns) (pr-str (defn a-fun [])))}
{:result "#'user/a-fun"}
aaa-some-new-ns=> So that reproduces 😢. Sad that's a Clojure thing...
yeah, it is interesting how this two things behave :
clj -e "(do (ns aaa-some-new-ns) (defn a-fun []))"
#'aaa-some-new-ns/a-fun
clj -e "[(do (ns aaa-some-new-ns) (defn a-fun []))]"
[#'user/a-fun]looks like it takes a different path in the compiler
this has to do with top level do being unnested
BTW, lumo fails on both (do (ns...) and [(do (ns... and Babashka/nbb passes on both 😄
(This for Clojure - Babashka does what I expected, and returns "#'new-ns/a-fun"