unrepl

discussing specification of an edn-based repl and its implementations.
2017-08-08T15:56:00.341411Z

I’ve been following the unrepl stuff for a short while, and I find it kinda annoying that many repl’s are tied to their development environments; e.g. proto-repl-charts, gorilla-repl etc… The stuff Stuart Halloway said in his recent talk about sidecars really resonates. Anyway it got me thinking that what would be super useful is having a broadcast repl, that could broadcast interactions/responses over some mechanism (perhaps pub/sub) so that sidecar repl clients could render results for you. The idea would be that I could for example keep my editors REPL, but have a a sidecar client connected to the same unrepl server, listen for evaluation results and render them… e.g. it could render a stream of proto-repl charts, if they conformed to the right type, or it could render a tree view for exploring datastructures; without having to work directly with my editor and its REPL (Emacs). Has anyone else thought about this at all? Would unrepl support it?

cgrand 2017-08-08T16:00:41.531167Z

To me the “integration hub” is the client not the server. One reason is that it doesn’t assume that all repls servers are not local and easily connectable.

2017-08-08T16:02:07.588389Z

ok, so you’d have a broadcast client that would broadcast its interactions to clients that are connected in turn to it?

cgrand 2017-08-08T16:02:35.606898Z

Last week I’ve been thinking about zeroconf and how it could be used

dominicm 2017-08-08T16:03:14.631473Z

That seems very useful for this problem.

2017-08-08T16:05:53.734226Z

hmmm maybe… its been a while since I looked into bonjour; when I last looked a lot of it was pretty immature; apart from the mDNS side

2017-08-08T16:06:13.746027Z

something to think about some more…

ghadi 2017-08-08T16:06:34.759090Z

i had an old spike of a bonjour like REPL data sharing thing

2017-08-08T16:09:34.868297Z

anyway user side it’d be nice to have something like an electron client app that would only render datastructures… it’d let you drill down into deeply nested hashmaps etc… but not really receive any code to process.

👍 1
2017-08-08T16:12:29.977336Z

but Emacs and its REPL wouldn’t need to care

richiardiandrea 2017-08-08T16:13:49.024677Z

@rickmoynihan there has been some conversation on that here and interestingly enough two sides of the coin arised. @thheller's shadow-cljs preaches multiple connections for tooling (if I need to auto complete, I do it on a separate connection). The other side will be multiplexing on the same connection (keep a mapping session <-> connection IIRC but Christophe can correct me here).

richiardiandrea 2017-08-08T16:14:22.044177Z

Unrepl does not have multiplexing atm and about shadow-cljs, I was playing with an emacs client that opens connections ad-hoc

2017-08-08T16:15:16.076098Z

yeah I’ve read those discussions… multiplexing gets pretty messy in my experience; so I’m more sympathetic to having multiple connections - though not sure what cons that approach might have

2017-08-08T16:17:32.157821Z

in my mind multiplexing protocols on a single socket is always prone to the latency issue where there’s data ahead of you in the network buffer.

richiardiandrea 2017-08-08T16:22:28.333186Z

probably makes state management more messy...I guess?

2017-08-08T16:23:35.372184Z

IIRC many, many moons ago, Rich was arguing that nREPL should be designed using STOMP, which would’ve in theory enabled a lot of stuff like this… At the time I was implementing a message broker using STOMP, and recall that actually the protocol was horrendously underspecified… It was only superficially simple because it was vague… I remember researching the MQTT protocol at the time, which by comparison was awesome, and well specified.

ghadi 2017-08-08T16:23:37.373328Z

@cgrand https://github.com/ghadishayban/undersea

👍 1
2017-08-08T16:23:57.384969Z

@ghadi: cool.

ghadi 2017-08-08T16:24:41.410429Z

i wanted to share data with co-worker's REPLs.

ghadi 2017-08-08T16:24:45.413567Z

gosh the code is gross

dominicm 2017-08-08T16:26:08.463021Z

https://github.com/jonpither/cider-spy possibly related (aimed at emacs ofc)

2017-08-08T16:30:23.616500Z

yeah I’d seen cider-spy before; pretty cool… but sharing REPL’s with coworkers isn’t something I want to do 🙂

cgrand 2017-08-08T16:32:44.702020Z

At some point I had an electron-based repl that allowed browsing but the rendering was crude. There's a gif floating around

cgrand 2017-08-08T16:42:34.042887Z

Not in my experience. The main drawback is that it does not work when creating when new connections are expensive or impossible.

cgrand 2017-08-08T16:43:57.090027Z

Other minor drawback: the server can't initiate a new connection.

cgrand 2017-08-08T16:45:39.149908Z

The first drawback is vastly mitigated by the fact that a repl can be upgraded into a multiplexed server.

2017-08-08T16:47:38.219024Z

cool

pesterhazy 2017-08-08T17:00:20.671617Z

@cgrand is this new?

pesterhazy 2017-08-08T17:00:44.686773Z

also you sure type fast

cgrand 2017-08-08T17:01:34.717433Z

Not new unearthing it for @rickmoynihan

pesterhazy 2017-08-08T17:03:21.781578Z

I was thinking of trying out Unrepl-over-http - exposing Unrepl's EDN as an HTTP POST endpoint

pesterhazy 2017-08-08T17:04:05.807933Z

That could be read from, say, a Reagent clojurescript app, which takes care of the presentation and requests sequence expansions as necessary

dominicm 2017-08-08T17:04:54.836435Z

@pesterhazy SSE is perhaps the most appropriate, no? Unrepl is more of a stream?

dominicm 2017-08-08T17:05:03.841210Z

(This would actually make auth really easy)

2017-08-08T17:05:29.856021Z

nice! 🙂 I think the only difference between that and what I’m saying is that I’d leave the evaluation/entry of code out of that REPL, and have it only display values and expand them

👍 1
2017-08-09T09:01:05.242345Z

Maybe, I just think there are a lot of environments (Emacs, vim, console repl etc) that aren’t going to grow a rich graphical interface anytime soon. So decoupling such a thing from the editor seems to make sense. It depends on the other tools/workflow you’re using as to whether it would be cumbersome; but I think alt-tabing to a different window isn’t too much of a burden in the worst case. In the better cases you could integrate via a tiling window manager etc… I think that the emacs REPL would still basically work as it is, and that the results of evaluations would be broadcast to the different rendering frontends, so the Emacs REPL would also render the datastructure, exploring that value just wouldn’t be as nice… Just thinking interfaces driven off of unrepl ellipsis might be richer and more widely useful if they didn’t have to be tied to be a specific editor

cgrand 2017-08-09T09:20:25.658401Z

I agree.

sooheon 2017-08-16T05:50:03.000058Z

This sounds awesome, because this is essentially what I have going on in a more roundabout way with emacs and gorilla-repl. The only difference is that I require the ns I’m working on in emacs from gorilla-repl, and have to eval the datastructures/visualizations again in gorilla-repl.

pesterhazy 2017-08-08T17:06:01.874251Z

@dominicm, right, Unrepl is a stream, but to implement a interactive, expanding tree I think you want request/response semantics

pesterhazy 2017-08-08T17:06:50.901515Z

although I could be wrong

richiardiandrea 2017-08-08T17:22:33.435178Z

well websockets can still be used as request/response, and it has probably easier implementation...maybe

richiardiandrea 2017-08-08T17:23:07.453867Z

also re-frame can integrate pretty well with this by being event/message based

richiardiandrea 2017-08-08T17:23:40.472994Z

oh having the choice is the best of both worlds then

dominicm 2017-08-08T17:42:04.109400Z

@pesterhazy I thought you were thinking of exposing all of unrepl

pesterhazy 2017-08-08T19:03:45.049756Z

@dominicm, I was more thinking of a sidecar window (in a browser) that can be used to visualize data structures

dominicm 2017-08-08T19:05:06.096953Z

@pesterhazy makes more sense. :) unless it's large :thinking_face: might be better to be able to run the code

cgrand 2017-08-08T19:54:21.704297Z

Switching application to be able to expand seems cumbersome for something so common. Ymmv