A draft of a simplified unrepl session:
< [:unrepl/hello {:actions {:echo (some.impl/set-echo-mode :unrepl/echo-mode)}]
< [:prompt {... ...}]
> (Thread/sleep 10000)
< [:started-eval {:actions {:interrupt (some.impl/interrupt 12 1)}} 1]
< [:eval nil 1]
Actions are now plain edn structures, all keywords should be substituted (unless quoted with #unrepl/quote
).
Actions are meant to be sent to another (un)repl.
There would be a new :started-eval
message emitted right after read and before evalnice
the purpose of :started-eval
is to advertise side-channel actions like interrupt?
yes and also to give feedback to the client that the repl is evaluating (rather than waiting for more inmput)
ah cool
so if I send (def
I know that I should display >
to prompt the user to continue typing the form?
yes but you would be sensitive to timeouts
probably better for the client to understand clojure syntax enough to know when a closing paren is missing
I think :echo
messages could help too. Something like [:echo {:file “” :start-line N :end-line N :start-column N :end-column N :offset :len} 1]
to help clients keep track of which expression maps to which eval (especially when you end several at once)
interesting
I’ve lost time resisting the multiple connections approach, it makes things much more simple
I consider the draft stable enough again to take criticism and questions.
First version of (future) unrepl client, unravel: https://github.com/pesterhazy/unravel. So far only a simple readline-enabled netcat-like tcp client.
Next step: inject unrepl boostrap code on connect to get EDN responses
OK, basic unravel functionality works: - uses current unrepl payload - readline - exceptions - color to differentiate eval output from stdout
For simplicity payload.clj is shamelessly copied from the unrepl repo
@pesterhazy fantastic! No nil for the print?
It should be there, I noticed, too, that sometimes nil
is not printed, not sure why
(println :foo)
[:out ":foo" 1]
[:out "\n" 1]
[:eval nil 1]
[:prompt {:cmd false, clojure.core/*warn-on-reflection* false, clojure.core/*ns* <#C4C63FWP5|unrepl>/ns unrepl.repl}]
I see it in nc, so there must be something fishy on my side
will have a look tomorrow