dev-tooling

mauricio.szabo 2023-05-01T02:49:04.819759Z

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?

cfleming 2023-05-01T21:49:12.706669Z

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).

cfleming 2023-05-01T21:50:08.597289Z

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

flowthing 2023-05-02T05:11:26.124449Z

> 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.

2023-05-01T06:00:39.472109Z

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

flowthing 2023-05-01T06:59:24.471289Z

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.)