Hello, I'm writing a small utility that communicates with nrepl. I just started, but can't seem to figure it why some repls like repl- y work with ( dirac! :join) but others like parle don't support it. I can't seem to make it work when running some simple nrepl examples using nrepl/client and nrepl/message either. Any guidance would be greatly appreciated!
@jeffrey.schaefer Hi, I don’t have REPL complexity in my head right now, I’ve hacked on Dirac 2yrs ago and since then I
’ve been only maintaining it
but I’m willing to look at it if you could share some testing repo, or something
dirac! :join
was really tested only with leiningen’s REPL by me (which is reply based AFAIK)
i've been trying to read the repl-y source to see if maybe it does something special, but im still new to clojurescript, and even newer to clojure and don't understand a ton of java
I’m afraid that the main complexity will come from REPL/nREPL itself, quite complex stuff especially for a newcomer
what is parle
? I’m not able to google it
oh sorry, it is a node based clojurescript repl
i have more of a js background, so i was using that to test differences with repl-y
I’m trying to recall what is nREPL client actually doing and why it needs bencode 😉
this could be an issue https://github.com/binaryage/dirac/blob/master/src/nrepl/dirac/nrepl/transports/bencode_workarounds.clj
could you try to eval some cljs code after that (dirac! :join)
? e.g. (js/console.log "test")
or better something which is specific to the browser context, so we don’t confuse it with node
js/window
so ive tried it both directly after and after the return of (dirac! :join)
wait, you must be using the same repl connection and session
first you join dirac, this will switch nREPL server to execute your REPL session messages different way, actually compiling them with cljs an dsending them to browser
the repl that im calling this other repl from should be different
but i may not understand what you are saying, and also may have something confused
this last code snippet behaves as expected, when you connect nREPL and try to eval “js/window” it cannot work, because it is complied by clojure - by default you get clojure REPL
so that snippet was a follow up to calling the same code but with (dirac! :join) as the op
i also tried calling (dirac! :join) in the op, with another method calling js/alert in the same op,
not sure if thats what you meant though
but each snippet seems to open a new client connection
right
I’m not aware of the api you are using, what is this “repl” ns?
oh sorry, let me get some info
the area related to talking to an nrepl programmatically
i was referring to the nrepl.core namespace
ok
try something like this
this will open one client connection and then use it
each new connection will have a separate “session” and is somewhat isolated
https://nrepl.org/nrepl/0.6.0/design/middleware.html#_sessions
ok i tried that and it returned this...
ok, figure out that doall stuff, not sure where to place it
maybe you don’t need it at all
I was following their comment “;; message
and client-session
all return lazy seqs”
oh i think i see
the first doall on line 2 is likely not needed
this has all been very helpful btw, thank you very much!
repl/message can deal with lazy-seq (whatever it is) :_)