Fork me on GitHub
#unrepl
<
2017-03-29
>
cgrand12:03:01

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.

cgrand12:03:39

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

cgrand12:03:22

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

cgrand12:03:27

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.)

cgrand13:03:59

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

thheller14:03:05

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

thheller14:03:34

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

thheller14:03:03

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

cgrand14:03:21

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

thheller14:03:29

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

thheller14:03:39

but how would tool get at that REPL?

thheller14:03:15

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

cgrand14:03:37

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

thheller14:03:03

really? doh

cgrand14:03:27

a little bird told me it changed recently

thheller14:03:55

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

cgrand14:03:27

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

cgrand14:03:47

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

dominicm15:03:58

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

pesterhazy15:03:01

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

dominicm15:03:12

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

pesterhazy15:03:09

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

pesterhazy15:03:30

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

dominicm15:03:58

Vim7 works with nrepl & fireplace.

dominicm15:03:49

So you just do sync in Vim7 (like now)

cgrand15:03:25

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

pesterhazy15:03:12

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

pesterhazy15:03:25

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