dirac

Dirac v1.7.2 is out: https://github.com/binaryage/dirac/releases/tag/v1.7.2
welp 2019-03-08T16:36:12.005700Z

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!

2019-03-08T16:37:39.006600Z

@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

2019-03-08T16:37:46.006900Z

’ve been only maintaining it

2019-03-08T16:38:03.007500Z

but I’m willing to look at it if you could share some testing repo, or something

2019-03-08T16:38:57.008400Z

dirac! :join was really tested only with leiningen’s REPL by me (which is reply based AFAIK)

welp 2019-03-08T16:43:26.010900Z

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

2019-03-08T16:44:42.012800Z

I’m afraid that the main complexity will come from REPL/nREPL itself, quite complex stuff especially for a newcomer

2019-03-08T16:45:33.014200Z

what is parle ? I’m not able to google it

welp 2019-03-08T16:45:46.014500Z

oh sorry, it is a node based clojurescript repl

welp 2019-03-08T16:46:02.014700Z

https://www.npmjs.com/package/parle

welp 2019-03-08T16:46:17.015200Z

i have more of a js background, so i was using that to test differences with repl-y

welp 2019-03-08T16:47:25.015700Z

2019-03-08T16:49:40.018300Z

I’m trying to recall what is nREPL client actually doing and why it needs bencode 😉

2019-03-08T16:54:33.019500Z

could you try to eval some cljs code after that (dirac! :join)? e.g. (js/console.log "test")

2019-03-08T16:55:18.020100Z

or better something which is specific to the browser context, so we don’t confuse it with node

2019-03-08T16:55:42.020400Z

js/window

welp 2019-03-08T17:16:15.021600Z

so ive tried it both directly after and after the return of (dirac! :join)

welp 2019-03-08T17:17:11.022Z

2019-03-08T17:17:47.023Z

wait, you must be using the same repl connection and session

2019-03-08T17:18:32.024Z

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

welp 2019-03-08T17:20:08.025700Z

the repl that im calling this other repl from should be different

welp 2019-03-08T17:20:24.026400Z

but i may not understand what you are saying, and also may have something confused

2019-03-08T17:20:27.026700Z

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

welp 2019-03-08T17:20:54.027300Z

so that snippet was a follow up to calling the same code but with (dirac! :join) as the op

welp 2019-03-08T17:21:22.028100Z

i also tried calling (dirac! :join) in the op, with another method calling js/alert in the same op,

welp 2019-03-08T17:21:28.028500Z

not sure if thats what you meant though

2019-03-08T17:21:37.028600Z

but each snippet seems to open a new client connection

welp 2019-03-08T17:21:41.028900Z

right

2019-03-08T17:21:51.029400Z

I’m not aware of the api you are using, what is this “repl” ns?

welp 2019-03-08T17:22:04.029700Z

oh sorry, let me get some info

welp 2019-03-08T17:22:53.029900Z

https://nrepl.org/nrepl/0.6.0/usage/clients.html

welp 2019-03-08T17:23:36.030500Z

the area related to talking to an nrepl programmatically

welp 2019-03-08T17:24:11.031200Z

i was referring to the nrepl.core namespace

2019-03-08T17:25:11.031400Z

ok

2019-03-08T17:25:22.031500Z

try something like this

2019-03-08T17:26:09.032500Z

this will open one client connection and then use it

2019-03-08T17:26:31.033Z

each new connection will have a separate “session” and is somewhat isolated

welp 2019-03-08T17:32:55.033300Z

ok i tried that and it returned this...

2019-03-08T17:33:33.033900Z

ok, figure out that doall stuff, not sure where to place it

2019-03-08T17:33:44.034100Z

maybe you don’t need it at all

2019-03-08T17:34:48.034500Z

I was following their comment “;; message and client-session all return lazy seqs”

welp 2019-03-08T17:35:47.035600Z

oh i think i see

2019-03-08T17:36:01.036100Z

the first doall on line 2 is likely not needed

welp 2019-03-08T17:36:01.036200Z

this has all been very helpful btw, thank you very much!

2019-03-08T17:36:28.036600Z

repl/message can deal with lazy-seq (whatever it is) :_)