how do socket repl's and REBL interact? I expected i could clj -M:rebl
and then nc localhost 50505
and see results in the rebl UI from the netcat session. However, only things entered in the original process with clj -M:rebl
appear there
Rebl must need a special repl to capture results for the gui
yeah. was expecting to see something about it in the documentation. I know sean uses it with a socket repl so i'm surprised to see it seems to need a bit more configuration
The socket repl is actually a generic framework for launching processes on sockets, which is configurabls
So you may be able to launch the socket repl with whatever custom repl rebl needs
yeah was wondering if there was a premade "accept" function in cognitect.rebl
made for this but not seeing anything
https://github.com/admiralbumblebee/cider-rebl/blob/master/.emacs
ah, it seems sean hijacks things on
wrap_in_rebl_submit = (code) ->
"(let [value " + code + "] " +
" (try" +
" ((requiring-resolve 'cognitect.rebl/submit) '" + code + " value)" +
" (catch Throwable _))" +
" (try" +
" ((requiring-resolve 'my.repl/reveal) value)" +
" (catch Throwable _))" +
" value)"
https://github.com/DaveWM/nrepl-rebl/blob/master/src/nrepl_rebl/core.clj#L41
yeah i've got it working with nrepl and ricky moynihan's middleware. I am a bit surprised that nrepl seems to have a better story for it than socket repls
i expected to setup socket-repl with rebl and use inf-clojure and have the first class experience.
i guess a sub repl works
(clojure.main/repl
:read
(fn [request-prompt request-exit]
(let [x (clojure.main/repl-read request-prompt request-exit)]
(if (= x :repl/quit)
request-exit
x)))
:eval
(fn [form]
(let [result (eval form)]
(cognitect.rebl/submit form result)
result)))
@dpsutton For REBL, I have https://github.com/seancorfield/socket-rebl -- a variant of that would work for tap>
and hence Reveal.
aha. i was thinking there might be something like that. thanks
Note: if you use a client like Chlorine, Clover, or unrepl/unravel with that library it "doesn't work" because those clients all spin up a second socket REPL and use that for the actual evaluation 😐 but it works great for "dumb" clients.
Sure enough, if I can make this work for Chlorine, it'll work for Clover too. I was trying to figure out why someone would want to use the "Inferior REPL mode", but now I have an example 😄
tool question: what do you use to explore the call graph of your functions? clojure-lsp
has a feature that lets you see all the functions that call your function in a tree (they call it incoming
call hierararchy. The other direction, the outgoing
call hierarchy, doesn't seem to be implemented (why?). Do you use another kind of tool to explore your codebase?
@meditans This tools is based on clj-kondo's output: https://github.com/benedekfazekas/morpheus
thanks @borkdude!
you may want to ask in #lsp