unrepl

discussing specification of an edn-based repl and its implementations.
cgrand 2017-03-30T12:21:37.551597Z

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

pesterhazy 2017-03-30T12:27:58.641492Z

nice

pesterhazy 2017-03-30T12:29:12.658920Z

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

cgrand 2017-03-30T12:31:06.688165Z

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

pesterhazy 2017-03-30T12:31:13.689865Z

ah cool

pesterhazy 2017-03-30T12:31:44.697764Z

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

cgrand 2017-03-30T12:33:00.716988Z

yes but you would be sensitive to timeouts

pesterhazy 2017-03-30T12:33:55.730663Z

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

cgrand 2017-03-30T12:37:39.786254Z

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]

cgrand 2017-03-30T12:38:45.803122Z

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

pesterhazy 2017-03-30T12:39:15.810533Z

interesting

cgrand 2017-03-30T14:44:01.495817Z

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

cgrand 2017-03-30T15:00:01.907297Z

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

pesterhazy 2017-03-30T15:20:18.433107Z

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

pesterhazy 2017-03-30T15:21:06.453745Z

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

pesterhazy 2017-03-30T21:05:00.143820Z

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

pesterhazy 2017-03-30T21:06:06.166232Z

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

cgrand 2017-03-30T21:09:45.237263Z

@pesterhazy fantastic! No nil for the print?

pesterhazy 2017-03-30T21:14:54.333478Z

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

pesterhazy 2017-03-30T21:18:25.398666Z

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

pesterhazy 2017-03-30T21:18:36.402003Z

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

pesterhazy 2017-03-30T21:18:45.404610Z

will have a look tomorrow