Fork me on GitHub
#tools-deps
<
2019-10-17
>
Jakub Holý (HolyJak)14:10:39

REBL advice needed (is the a better channel?) : I run a remote nrepl server and connect to it with a local nrepl client (mostly via Cursive). I want to include REBL but run it on the local machine, not the server. Is it possible? (I know there is a nrepl middleware for REBL but I guess it assumes REBL is running on the same jvm as the repl itself). Thank you!

❤️ 4
Aleksander19:10:01

#rebl

❤️ 4
rickmoynihan08:10:40

It’s not possible. REBL has to exist in the same JVM as the forms it’s browsing. I spoke to Rich about this a while back, and IIRC it’s because to do it you need to implement weak-references over the wire; to enable GC etc. (He implemented such a system years ago in common lisp http://foil.sourceforge.net/ and I guess wanted to avoid the complexity for only marginal use-cases)

rickmoynihan08:10:20

my nrebl middleware works reasonably well though but it does assume you’re in the same vm: https://github.com/RickMoynihan/nrebl.middleware

Jakub Holý (HolyJak)09:10:43

I see, thank you! 😢

vlaaad14:10:40

there is #rebl

vlaaad14:10:20

I played with rebl, can't tell anything about nrepl, but rebl uses prepl, and you can pass your own prepl function to it

vlaaad14:10:54

cognitect.rebl/ui accepts :proc keyword argument, which should be a function of 2 args: in-reader and out-fn, as clojure.core.server/prepl

vlaaad14:10:48

there is clore.core.server/remote-prepl, which can be transformed to satisfy :proc

vlaaad14:10:53

I played with it, here is what worked for me:

(cognitect.rebl/ui :proc
                   #(clojure.core.server/remote-prepl
                      "localhost" 50505
                      %1 %2
                      :valf (partial clojure.edn/read-string {:default tagged-literal})))

rickmoynihan08:10:08

I’m pretty sure this approach won’t work properly, especially wrt the datafy/nav behaviours. https://clojurians.slack.com/archives/C6QH853H8/p1571386900140400?thread_ts=1571321859.133900&amp;cid=C6QH853H8

rickmoynihan08:10:35

though it may well be good enough for basic use

rickmoynihan08:10:51

but you’ll not get the metadata/protocol dispatch that REBL supports. REBL will only be able to walk the literal syntactic forms.

vlaaad08:10:52

yes, datafy/nav will be much more limited since it happens in the same vm and not over wire, but rebl will still work.

👍 4
rickmoynihan08:10:04

Also it won’t be able to follow the repl etc

vlaaad08:10:37

what do you mean follow the repl?

rickmoynihan08:10:18

forms evaled into nrepl won’t appear in REBL

rickmoynihan08:10:39

so only forms entered through REBL itself

rickmoynihan08:10:55

unless i’m misunderstanding something

vlaaad09:10:48

ah, yeah, I guess so, because rebl is a socket repl, and nrepl is not

rickmoynihan09:10:53

I don’t think it’s anything to do with the difference between socket-repl and nrepl. I think it’s more to do with that they’re in different processes and can’t share the stdin stream to intercept.

vlaaad14:10:56

(note, I used tagged-literal to be able to read what clojure can't usually read, for example clojurescript's js object notation: #js{:a 1})