I'm afraid we have a unrecoverable issue here. Creates freezing client-side (we could kludge-fix that by moving the exception handler further up).
To demonstrate:
Say you've got a data structure like:
([{{{id :entity/id, :as body} :results} :body, :as response}])
Here's a bencode roundtrip function:
(defn round-trip [data]
(let [encoded (let [b (java.io.ByteArrayOutputStream.)]
(clojure.tools.nrepl.bencode/write-bencode b data)
(str b))
_ (println encoded)
decoded (let [s (java.io.PushbackInputStream. (java.io.StringBufferInputStream. encoded))]
(#'clojure.tools.nrepl.transport/<bytes (clojure.tools.nrepl.bencode/read-bencode s)))]
decoded))
Here's how it normally works:
> (round-trip [1 2 3 4])
li1ei2ei3ei4ee
[1 2 3 4]
Here's what it does for our data structure:
ClassCastException clojure.lang.PersistentArrayMap cannot be cast to java.lang.String clojure.tools.nrepl.bencode/string>payload (bencode.clj:172)
Essentially, we can't use maps wherever there is a possibility of having non-strings as map-keys due to bencode itself, and there's no general strategy for dealing with this case on the backend, right? Wikipedia says 'All keys must be byte strings'. All I can think of as an alternative is to simply serialize data-keys (map?/sequential?) into strings. I will test out the ramifications of that.
Anyways, since arglists is the only thing using arbitrarily nested data, it's easy enough to fix for now. Cider will have to 'read' the :arglists-str key for eldoc bits, and I'll remove the :arglists here, but now we have a good rationale for why we should do it that way.
@bbatsov @tpope?