This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-07-28
Channels
- # announcements (21)
- # beginners (12)
- # calva (16)
- # cider (3)
- # clj-commons (23)
- # clojure (32)
- # clojure-europe (8)
- # clojure-norway (3)
- # clojure-uk (3)
- # clojurescript (12)
- # conjure (2)
- # cursive (6)
- # data-science (15)
- # datomic (5)
- # dev-tooling (10)
- # emacs (13)
- # events (3)
- # lsp (36)
- # missionary (6)
- # off-topic (22)
- # portal (46)
- # releases (1)
- # shadow-cljs (15)
- # slack-help (7)
- # sql (3)
- # squint (1)
- # timbre (5)
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
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"