unrepl

discussing specification of an edn-based repl and its implementations.
cgrand 2017-03-29T12:51:01.527724Z

Hi all, Let’s consider the plain repl (`lein run clojure.main -r`). What’s wrong with it as a repl meant to consumed by a UI richer than a term? non-readable and interleaved output, text-only (rendering images, tables, downloading big values etc.). The input of a repl is fine, the output is not. Things went bad as soon as we try to mess with input (all kind of discussions on escaping, buffering, concurrency etc.) You don’t kill a cat by sending a ^C to its stdin, you kill it by sending a ^C to the UI (the shell) that will use another channel (signals) to kill it.

cgrand 2017-03-29T12:51:39.538488Z

So everything else including control of the repl should happen through another connection.

cgrand 2017-03-29T12:53:22.568320Z

However since creating several connections is not always possible, one solution is to have a generic multiplexing layer.

cgrand 2017-03-29T12:59:27.676947Z

We would have this kind of scenario: 1/ connect to repl 2/ send multiplex upgrade 3/ open a repl (through the multiplexed link) since the first one has been upgraded away 4/ upgrade it to unrepl 5/ open more repls and upgrade them to whatever endpoints you need (completion, sideloading, unrepl control etc.)

cgrand 2017-03-29T13:00:59.709464Z

So basically there are now 3 decoupled concerns: unrepl, multiplex and discovering upgrading best-practices.

thheller 2017-03-29T14:01:01.982223Z

hey @cgrand

thheller 2017-03-29T14:01:05.983912Z

> However since creating several connections is not always possible, one solution is to have a generic multiplexing layer.

thheller 2017-03-29T14:01:34.995994Z

is that really something we should worry about for a tool driven REPL?

thheller 2017-03-29T14:06:03.103149Z

I mean in which scenario do you have a running REPL you can connect to with a tool but not launch another connection

cgrand 2017-03-29T14:06:21.110624Z

this serves two purposes: 1/ removing the need to mix control & input from unrepl (use N connections!) 2/ if you are stuck with one connection, you can always use this shim

thheller 2017-03-29T14:06:29.113690Z

only thing I can think of is running something on a server in tmux

thheller 2017-03-29T14:06:39.117177Z

but how would tool get at that REPL?

thheller 2017-03-29T14:07:15.130748Z

as soon as you have a socket and connected to it once you should be able to connect more than once no?

cgrand 2017-03-29T14:07:37.139822Z

being stuck with one connection is sometimes a limitation on the tool side (cough vim cough)

thheller 2017-03-29T14:08:03.149684Z

really? doh

cgrand 2017-03-29T14:08:27.158776Z

a little bird told me it changed recently

thheller 2017-03-29T14:11:55.240109Z

seems that could be solved on the client side though by launching a helper tool instead of directly connecting

cgrand 2017-03-29T14:50:27.200277Z

Even if it's because of a weird setup a helper tool can solve this.

cgrand 2017-03-29T14:51:47.234815Z

The point is we can assume the client can create plain repls at will. How is out of scope.

dominicm 2017-03-29T15:07:58.662631Z

Neovim makes it a doddle. Vim8 :thinking_face: Yeah, that should be good too. You can launch multiple jobs.

pesterhazy 2017-03-29T15:21:01.995703Z

I'd think if a client can't open multiple connection, it's their problem to fix

dominicm 2017-03-29T15:22:12.026384Z

I'm not sure I'd go that far.

pesterhazy 2017-03-29T15:23:09.050900Z

I mean you could envisage some sort of multiplexing proxy to deal with this limitation

pesterhazy 2017-03-29T15:24:30.086500Z

At any rate, the drawbacks of adding multiplexing (additional complexity) seem to weigh heavier than the potential reward (works with vim7?)

dominicm 2017-03-29T15:25:58.126098Z

Vim7 works with nrepl & fireplace.

dominicm 2017-03-29T15:26:49.147975Z

So you just do sync in Vim7 (like now)

cgrand 2017-03-29T15:27:25.163365Z

Just to be sure my position is not misunderstood: assume multiple connections. In constrained environment use some kind of multiplexing.

pesterhazy 2017-03-29T15:30:12.237168Z

I really like the recent simplification of the proposal by the way

pesterhazy 2017-03-29T15:31:25.270623Z

The idea of using a separate connection to implement ^C is cool