Clojure socket prepl cookbook

socketrepl
#1

I’ve written up a guide to starting various kinds of prepl servers, primarily as a handy document to help Conjure users but I think it’s pretty useful on it’s own too. I hope it helps you out!

https://oli.me.uk/2019-03-22-clojure-socket-prepl-cookbook/

4 Likes
#2

Got some questions,

How is prepl compared to nREPL, will prepl replace nREPL in some cases?

How many kinds of message will prepl return since there are at least 3 in nREPL?

#3

I asked something similar on the Slack channel a while back.

Basically, pRepl and nRepl are pretty similar in function. They really do the same thing. Except that pRepl is being worked on by the core team, whereas nRepl is run by the community.

Only time will tell if one will overthrow the other in popularity and usage, but for now, nRepl has the edge, and work on it has not stopped. That said, pRepl is bundled with Clojure, which makes it quite convenient to use.

They differ in the details of their implementation and protocol. Personally, I think the unrepl is superior to both of them.

Again, we shall see what happens. But a bit like there was Schema (from the community), and then came Spec (from core team), similar, yet taking a slightly different approach to how exactly to do it. pRepl (from core team), is similar to nRepl (from community), yet takes a slightly different approach.

I think pRepl always just return EDN. So I guess that would count as only one return format?

1 Like
#4

I still think nREPL is perfectly fine and strictly more powerful in every way. I just wanted to build on something much smaller where I didn’t have to depend on anything.

If you’re using nREPL and your tooling works, stick with it. Bug and the community have made something incredible with CIDER. I’m just offering some alternative for the Vim crowd really.

2 Likes
#5

It’s a pretty interesting situation with a different set of choices and tradeoffs. Having these choices is probably a good thing. I guess like you, for me, the overriding factor is less dependencies and the simplicity of:

clj -J-Dclojure.server.jvm="{:port 5555 :accept clojure.core.server/io-prepl}" -m myapp

that’s the main reason I have been using Atom with the Chlorine plugin and its use of the socket repl with unrepl. But your strategy is even leaner. Good job.

#6

Yep, there’s no unrepl involved in Conjure, it just fires Clojure code over a socket prepl and reads prepl responses. The feature set shouldn’t grow beyond the core editor integrations (autocomplete, doc, go to definition), any other feature should be something you set up bindings for.

Much like deps compared to lein, Conjure does less than CIDER/nREPL but you can compose it with more simple code to make something powerful. For some people this won’t be good enough, for others it’ll be easier to work with.

More choice!