reveal

Docs: https://vlaaad.github.io/reveal/ Source: https://github.com/vlaaad/reveal
seancorfield 2021-01-18T03:18:47.033Z

I played with your remote-repl a bit, figuring I might be able to use it as an :accept for a Socket REPL -- which works from the command-line but does not provide a traditional REPL interaction, insofar as it provides no prompt and doesn't print results, so Clover etc can't use it.

vlaaad 2021-01-18T06:21:25.033100Z

Hmm. I would expect no prompts in prepls, but how is it not printing results?

seancorfield 2021-01-18T18:45:21.036200Z

Just to confirm the setup I tested on: process A starts prepl on 4112; process B is Reveal's remote-prepl connected to 4112 and exposing 4113; process C was your remote-repl directly, connected to 4113:

;; process A log:
[INFO ] Starting Socket REPL server on port 4111...
[INFO ] ...Socket REPL server ready on port 4111
[INFO ] Starting Socket pREPL server on port 4112...
[INFO ] ...Socket pREPL server ready on port 4112
;; process B startup and log:
(! 555)-> clj -Sdeps '{:deps {vlaaad/reveal {:mvn/version "1.2.188"}}}' -X clojure.core.server/start-server :name '"reveal"' :accept vlaaad.reveal/remote-prepl :args '[:port 4112 ]' :port 4113 :server-daemon false
{:tag :ret, :val [1 2 3], :ns "user", :ms 1, :form "[1 2 3]"}
{:tag :ret, :val [4 5 6], :ns "user", :ms 0, :form "[4 5 6]"}
;; process C startup and log:
(! 635)-> clj -Sdeps '{:deps {vlaaad/remote-repl {:mvn/version "1.1"}}}' -X vlaaad.remote-repl/repl :port 4113
[1 2 3]
[4 5 6]
When process C connects to process B, the Reveal UI pops up. When I typed [1 2 3], it appeared in the Reveal UI and it was logged in process B but not printed back into process C. Same with [4 5 6].

seancorfield 2021-01-18T18:47:22.037300Z

If I type (System/getProperty "user.dir") into process C, I get the directory of process A, displayed in process B's UI and echoed to process B's console (as expected), but nothing comes back to process C.

vlaaad 2021-01-18T19:19:49.037900Z

@seancorfield this is a bug 🙂 I just released 1.2.189 with a fix

seancorfield 2021-01-18T19:47:02.038300Z

Nice! Ok, I'll update and re-test...

seancorfield 2021-01-18T19:50:44.038500Z

Yup, that works.

seancorfield 2021-01-18T19:52:24.039700Z

Is there a way, from the command-line, to tell Reveal's remote-prepl to print just the :val instead of the whole prepl result? You mentioned :out-fn above but I don't know how specify such a body via EDN...

vlaaad 2021-01-18T19:57:11.041Z

you'll need something like (defn print-val [prepl-result] (println (:val prepl-result))) somewhere on the classpath and then use :out-fn my.ns/print-val

vlaaad 2021-01-18T19:58:57.042300Z

maybe it has to be prn , not sure about that..

vlaaad 2021-01-18T20:00:11.043300Z

clojure.core.server/start-server does not evaluate code for args, only reads forms as edn, not sure there is a way to just supply the form

seancorfield 2021-01-18T20:00:38.043700Z

OK, that's what I thought... Trying that now...

seancorfield 2021-01-18T20:02:32.044300Z

That doesn't seem to echo back to the client C -- just prints on B.

seancorfield 2021-01-18T20:07:36.044700Z

Neither println nor prn seem to work.

vlaaad 2021-01-18T20:21:09.045300Z

ah jeez, I committed my fix without spending enough time in a hammock..

vlaaad 2021-01-18T20:26:17.046100Z

I probably should wrap with bound-fn* not only the default out-fn, but provided too

seancorfield 2021-01-18T20:29:22.046400Z

Oh, it's losing the binding of the output stream?

vlaaad 2021-01-18T20:35:39.046800Z

yeah... try 1.2.190 🙂

vlaaad 2021-01-18T20:36:35.047200Z

feels strange to demote prepl to repl 😄

seancorfield 2021-01-18T20:51:32.047600Z

Yeah, that echoes stuff as expected to the client now. Thanks.

seancorfield 2021-01-18T20:53:14.049200Z

This was an experiment to see whether just returning the value like a regular REPL would be enough to persuade a client that it was dealing with a Socket REPL 🙂 But it isn't quite enough. I'll keep tinkering -- this at least works for my test bed. Thanks!

vlaaad 2021-01-18T20:57:08.049800Z

It's to make clover to play with reveal more directly, right?

seancorfield 2021-01-18T20:59:59.052Z

It was my original motivation. I suspect that it isn't enough to convince unrepl to side-load across the linked processes but I'll dig into it all at a later date at this point.

seancorfield 2021-01-18T21:00:59.052500Z

I'm happy that some of the behavior I was observing was due to Reveal bugs which are now fixed! 🙂

😀 1