Fork me on GitHub
#dev-tooling
<
2023-05-01
>
mauricio.szabo02:05:04

Folks, with the recent announcement of Morse, also came the announcement of Replicant. I confess it sounded interesting for me, in theory, but I'm afraid of "jumping in the hype" and commit the same error I made when I decided to use Socket REPL for Chlorine... what do you folks think about this Replicant idea?

jackrusher06:05:39

It would be nice if there were common infrastructure for paging through structures on the JVM from clients. My understanding is that it’s still relatively young atm. See, for example, this issue: https://github.com/clojure/data.alpha.replicant-server/issues/1

flowthing06:05:24

I’ve only taken a cursory look, but it does look very interesting. One thing to note, though, is that since it is hosted over prepl, you’ll have to send unstructured input:

λ clj -Sdeps '{:deps {io.github.clojure/data.alpha.replicant-server {:git/tag "v2023.04.25.01" :git/sha "039bea0"}}}'
Clojure 1.11.1
user=> (require '[clojure.data.alpha.replicant.server.prepl :as replicant])
nil
user=> (replicant/start :host "localhost")
Replicant server listening on 5555 ...
#object[java.net.ServerSocket 0x68f0f72c "ServerSocket[addr=localhost/127.0.0.1,localport=5555]"]
user=>

...

λ nc localhost 5555
(range 512)
{:tag :ret, :val "#r/seq {:head [0 1 2 3 4 5 6 7 8 <SNIP>], :rest #uuid \"f0fc2c09-69b5-4608-b45f-6e3d49ee73d4\"}", :ns "user", :ms 1, :form "(range 512)"}
So if you want to do things like send over the namespace, filename, and line and column info of the thing you’re evaluating, you’ll need to either send that over a separate channel or implement an alternative to clojure.data.alpha.replicant.server.prepl that accepts structured input yourself. (Which shouldn’t be too difficult, of course.)

cfleming21:05:12

I’m hoping that the interesting serialisation bit is mostly decently separated from the REPL technology, since I don’t use prepl at the moment (I could add it, of course, but I’d rather not).

cfleming21:05:08

But I haven’t had a chance to look at it in detail yet.

flowthing05:05:26

> I’m hoping that the interesting serialisation bit is mostly decently separated from the REPL technology Same. Ideally, the interesting bit would be part of Clojure to avoid having to take a dep, but I’m not sure how likely that is to happen.