Fork me on GitHub
#dev-tooling
<
2023-07-28
>
mauricio.szabo20:07:54

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?

jpmonettas21:07:27

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"

mauricio.szabo21:07:18

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 [])))}

jpmonettas21:07:04

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=> 

mauricio.szabo21:07:52

So that reproduces 😢. Sad that's a Clojure thing...

jpmonettas22:07:48

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]

jpmonettas22:07:30

looks like it takes a different path in the compiler

borkdude22:07:39

this has to do with top level do being unnested

mauricio.szabo00:07:33

BTW, lumo fails on both (do (ns...) and [(do (ns... and Babashka/nbb passes on both 😄

👍 2
mauricio.szabo20:07:10

(This for Clojure - Babashka does what I expected, and returns "#'new-ns/a-fun"