Fork me on GitHub
#unrepl
<
2017-03-30
>
cgrand12:03:37

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 eval

pesterhazy12:03:12

the purpose of :started-eval is to advertise side-channel actions like interrupt?

cgrand12:03:06

yes and also to give feedback to the client that the repl is evaluating (rather than waiting for more inmput)

pesterhazy12:03:44

so if I send (def I know that I should display > to prompt the user to continue typing the form?

cgrand12:03:00

yes but you would be sensitive to timeouts

pesterhazy12:03:55

probably better for the client to understand clojure syntax enough to know when a closing paren is missing

cgrand12:03:39

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]

cgrand12:03:45

to help clients keep track of which expression maps to which eval (especially when you end several at once)

cgrand14:03:01

I’ve lost time resisting the multiple connections approach, it makes things much more simple

cgrand15:03:01

I consider the draft stable enough again to take criticism and questions.

pesterhazy15:03:18

First version of (future) unrepl client, unravel: https://github.com/pesterhazy/unravel. So far only a simple readline-enabled netcat-like tcp client.

pesterhazy15:03:06

Next step: inject unrepl boostrap code on connect to get EDN responses

pesterhazy21:03:00

OK, basic unravel functionality works: - uses current unrepl payload - readline - exceptions - color to differentiate eval output from stdout

pesterhazy21:03:06

For simplicity payload.clj is shamelessly copied from the unrepl repo

cgrand21:03:45

@pesterhazy fantastic! No nil for the print?

pesterhazy21:03:54

It should be there, I noticed, too, that sometimes nil is not printed, not sure why

pesterhazy21:03:25

(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}]

pesterhazy21:03:36

I see it in nc, so there must be something fishy on my side

pesterhazy21:03:45

will have a look tomorrow