Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement an EDN transport #60
Comments
bbatsov
added
Enhancement
Help Wanted
Good First Issue
labels
Oct 22, 2018
Oct 22, 2018
This was referenced
This comment has been minimized.
This comment has been minimized.
Let me nudge this along... Since
With EDN it would be something along these lines instead: ;; require EDN: [clojure.edn :as cljedn]
(defn edn
"Returns a Transport implementation that serializes messages
over the given Socket or InputStream/OutputStream using EDN."
([^Socket s] (edn s s s))
([in out & [^Socket s]]
(let [in (PushbackInputStream. (io/input-stream in))
out (io/writer out)]
(fn-transport
#(cljedn/read in)
#(rethrow-on-disconnection s
(locking out
(doto out
(.write %)
.flush)))
(fn []
(if s
(.close s)
(do
(.close in)
(.close out)))))))) Am I going in the right direction here? |
This comment has been minimized.
This comment has been minimized.
Yeah, seems to me that you're moving in the right direction. The situation with EDN is much simpler because there's nothing really to encode/decode.
I think I'm missing something. Bencode won't be used at all in an EDN transport. |
This comment has been minimized.
This comment has been minimized.
Great, thanks.
I mean that it's used in the |
This comment has been minimized.
This comment has been minimized.
I made it into a commit here. I'll look at what else needs to be added for this to become a proper pull request. |
This comment has been minimized.
This comment has been minimized.
Looking forward to it! |
This comment has been minimized.
This comment has been minimized.
Btw, you can test the result like this:
That assumes you've named this protocol edn like this:
Maybe a name with |
This comment has been minimized.
This comment has been minimized.
Thanks for the nudge... |
This comment has been minimized.
This comment has been minimized.
Any time! |
This comment has been minimized.
This comment has been minimized.
I think that I've done it, but there is a failing test... The change is here Just dealing with this test failure:
Still WIP, so I'll clean it up a bit before making it a proper PR. |
This comment has been minimized.
This comment has been minimized.
Solved the failing test issue, it was just the way I required things. I'll open a PR to move the discussion there. |
bbatsov commentedOct 22, 2018
Having an EDN transport would simplify the lives of people using Clojure/ClojureScript/Java clients for nREPL. It should be pretty easy to create a transport based on the default bencode transport that simply uses EDN instead of bencode. Here's the implementation of the
bencode
transport as a reference:The best thing about this transport is that it requires no extra deps, so it can be easily bundled with nREPL itself.