Fork me on GitHub
#lumo
<
2019-11-01
>
grav06:11:18

Interesting. No warning in Clojure. But same happens with Planck:

$ planck 
ClojureScript 1.10.520
cljs.user=> (ns foo.bar (:require [clojure.string :as str]))
nil
foo.bar=> str/upper-case
#object[Function]
foo.bar=> (ns foo.bar)
nil
foo.bar=> str/upper-case
          ^
WARNING: No such namespace: str, could not locate str.cljs, str.cljc, or JavaScript source providing "str" at line 1 
WARNING: Use of undeclared Var str/upper-case at line 1 
Execution error (ReferenceError) at (<cljs repl>:1).
Can't find variable: str

sogaiu06:11:17

@grav thanks for the data point! i heard this doesn't occur for shadow-cljs.

grav06:11:11

Okay ... maybe it's something with self-hosted? Anyway, I'm normally using in-ns for these things (this is what Cursive also uses). Eg:

cljs.user=> (ns foo.bar (:require [clojure.string :as str]))
nil
foo.bar=> (ns baz.buz)
nil
baz.buz=> (in-ns 'foo.bar)
foo.bar=> str/upper-case
#object[Function]
foo.bar=> 

sogaiu06:11:28

the background is that at #chlorine we're working on trying to figure out stuff we can send to a variety of repls -- the following was working for non-clojurescript repls:

(if (find-ns 'foo.bar) (in-ns 'foo.bar) (ns foo.bar))

sogaiu06:11:38

thanks for the info on what cursive uses -- does cursive work with self-hosted repls? i haven't tried.

grav06:11:38

I have used it together with lumo actually. Lumo exposes a socket repl, and when I used Cursive, it didn't support it directly. But then I launched (via Cursive) a clojrue program that used Mike Fikes' socket repl client https://github.com/mfikes/tubular for connecting.

grav06:11:56

I think Cursive will soon support socket repls directly though. Maybe already does 🙂

sogaiu07:11:03

yes, i've heard of tubular -- cool that those can be connected.

sogaiu07:11:14

thanks for the tips 🙂

sogaiu07:11:21

gotta go to sleep now

grav07:11:39

🙂 Np - sleep tight! 🙂

sogaiu07:11:45

take care!