unrepl

discussing specification of an edn-based repl and its implementations.
2018-03-12T08:56:36.000132Z

What is a good way to retrofit actions? I'm thinking about extensions to the client by third party libs. Thus far you'd have to regen the blob. Should there be some way to register actions after the fact? Once done so, they could be cached for a shaded blob.

dominicm 2018-03-12T08:59:43.000144Z

@kotarak I wanted to ask you about porting my library replant to use vimpire :)

2018-03-12T09:19:29.000041Z

This is exactly the situation I had in mind. Getting the support code on the server is easy due to the sideloader. There we can hook into the search path on the client side. Proper shading is up to the library. However, the library defined actions should behave like the official ones, cf. ensure-ns. Adding locally defined actions to the client is not a problem.

2018-03-12T09:22:05.000148Z

Hrmmmm.... Typing that makes me wonder, whether we can do this without unrepl even bothering. A simple: make-me-an-action-of-this-form would be enough. No need to actually modify the blob at all.

2018-03-12T09:24:30.000267Z

That would also take away the need to actually generate a blob beyond the unrepl one. Yeah! Got rid of a compile step for the client. Shading and b64ing are still necessary, though.

cgrand 2018-03-12T09:39:08.000340Z

ah the old open question of “should we allow dynamic registration of actions”...

cgrand 2018-03-12T09:42:53.000041Z

at first I thought it was a must have then I came to believe that the blob was king (at the same time my understanding on what unrepl changed from “an end product” to “a tool to create not-too-sucky private protocols”)

cgrand 2018-03-12T09:44:01.000398Z

the pendulum is swinging back (don’t worry there’s a damper somewher, each oscillation is less wide than the previous one)

cgrand 2018-03-12T09:46:03.000128Z

I’m trying to find what pieces of unrepl to expose at runtime. I’m pretty convinced that write is amongst them (there’s already something in unrepl.core).

cgrand 2018-03-12T09:47:35.000377Z

So the way to declare/patch/hook-up-into actions is certainly going to happen through write: write a message and let the client use it.

cgrand 2018-03-12T09:50:02.000375Z

:thinking_face: actually it doesn’t work because it’s the server we want to modify, adding actions at some points of the lifecycle and these actions would need some context to be passed in (eval if, session id etc.). A lot of things to commit to (from a design point of view) for which I don’t have a right answer yet.

cgrand 2018-03-12T09:51:14.000347Z

That’s why the “make your own blob” is easier.

cgrand 2018-03-12T09:54:29.000540Z

Plus dynamic registration only makes sense for actions known to the client (which is a finite set)

cgrand 2018-03-12T09:54:51.000497Z

We really need a couple of concrete examples.

2018-03-12T09:55:12.000275Z

I'm confused. Actions are just functions to be called. Blessed with hypermedia fairy dust. I mostly use what they return from eval. So they could be handled completely on the client side, no?

2018-03-12T09:58:20.000325Z

The blob is then sort of defeated.

2018-03-12T09:59:47.000039Z

Client A and Client A+Lib B could share client A, but won't because of blob shading.

2018-03-12T10:00:26.000616Z

My aesthetics (shiver) don't approve.

2018-03-12T10:00:46.000151Z

But maybe I misunderstand actions.

cgrand 2018-03-12T10:00:54.000480Z

I can’t think about this problem without examples.

2018-03-12T10:02:55.000297Z

I got vimpire. @dominicm got the fancify-this-code lib. He wants hook into vimpire. And I don't want to depend on his lib. So everyone has to generate a custom blob. Meh :-(

2018-03-12T10:04:05.000399Z

And I mean user! For their selection of extensions.

cgrand 2018-03-12T10:17:12.000405Z

Describe how he his lib can hook up into vimpire without vimpire having provisions for it, which kind of features are we talking about?

2018-03-12T10:20:25.000436Z

Eg. Have form. Send it to backend. Get it rewritten. Get it back. That sort of thing. Get info for completion. Get info for dynamic highlighting. Get docs. That sort thing. That's what my actions, FWIW.

2018-03-12T10:22:23.000309Z

I don't want to depend on external libs, eg. for refactoring. But I can provide the infrastructure.

2018-03-12T10:24:46.000402Z

vimpire#RegisterAction("my-action", ...) vimpire#Action(conn, "my-action", bindings, callbacks) That's how the internal ones work.

dominicm 2018-03-12T10:33:38.000065Z

I might be able to rely on eval for the most part.

dominicm 2018-03-12T10:34:34.000028Z

Unlike nrepl there's less of a need for custom actions. So eval & classloader callbacks should be plenty.

cgrand 2018-03-12T10:59:45.000330Z

All these actions seem very non-contextual (not related to a specific connection or to a specific evaluation) so eval-over-tooling like @dominicm suggests goes a long way. Also you could consider (write [:vimpire/client-eval “vimscript”])

dominicm 2018-03-12T11:00:33.000157Z

Why would I do vimscript in unrepl? :thinking_face:

cgrand 2018-03-12T11:02:08.000169Z

a clojure lib sending vimscript code to hook up in vimpire

cgrand 2018-03-12T11:03:03.000171Z

not saying it’s a good idea

dominicm 2018-03-12T11:07:09.000104Z

I see. I wonder if bi-directionality is useful. :thinking_face: I can think of some ideas.

dominicm 2018-03-12T11:07:18.000315Z

But not sure how I would trigger initially, so uncertain.

dominicm 2018-03-12T11:07:35.000047Z

But maybe a callback on completion would be better for async-stuff

2018-03-12T11:26:33.000311Z

So I can basically skip generation of the blob and just fire of required requires on initial connection. The actions are added locally without unrepl ever knowing about them. Having them helps with shading. I'm not sure what real action is then. I can only think of meta things like auxing, interruption, etc.

2018-03-12T11:28:38.000104Z

"Client-side actions" help keeping the infrastructure in the plugin simpler since all the interaction like read tracking and callbacking and whatnot is already handled.

2018-03-12T11:29:59.000203Z

I don't get where vimscript fits into the picture here. I rather not have my editor run foreign commands.

2018-03-12T20:20:09.000479Z

@dominicm Things come together. With now hopefully more standard names (<Plug>(vimpire_eval)) and cleaned up documentation. And also a set of small demos. Keen observers might spot that I obviously broke the completion. coughcough

2018-03-12T20:20:10.000577Z

https://github.com/kotarak/vimpire

2018-03-12T20:21:46.000096Z

However, pay attention to the correctly highlighted baz/yoyo.

dominicm 2018-03-12T20:22:48.000092Z

It occurs to me that I might need to port it to neovim channels.

2018-03-12T20:23:36.000373Z

Öh. Me has no clue about neovim.

2018-03-12T20:23:45.000491Z

Do its channels work differently?

2018-03-12T20:24:40.000542Z

It only ever does ch_open, ch_setoptions (to switch callbacks) and ch_sendraw.

2018-03-12T20:24:52.000292Z

And a ch_close somewhere in the repl.

dominicm 2018-03-12T20:36:09.000227Z

it does work differently, yeah

2018-03-12T20:37:16.000722Z

sigh Why can't we have cookies?

2018-03-12T20:37:20.000205Z

Very differently?

dominicm 2018-03-12T20:37:57.000638Z

uh, quite.

2018-03-12T20:39:05.000052Z

I'm not sure I even want to know how..... Do you think this can be easily hidden away? Or does it require a major rewrite? I mostly use callbacks everywhere...

2018-03-12T20:49:45.000270Z

Ok. A completion demo is now also up.

dominicm 2018-03-12T20:49:53.000637Z

it's callback based.

dominicm 2018-03-12T20:50:01.000113Z

But I don't think it has networking built-in.

dominicm 2018-03-12T20:50:12.000041Z

It uses msgpack-rpc to communicate, but I don't think that will affect you.

2018-03-12T20:54:24.000613Z

It says something about tcp here.

2018-03-12T20:55:04.000035Z

But it seems to mock around with newlines on the receiving end as far as I understood.

2018-03-12T20:55:28.000588Z

Seriously underwhelming.

2018-03-12T20:57:13.000681Z

I wonder how they distinguish "\n" from EOF. :thinking_face:

dominicm 2018-03-12T21:12:28.000553Z

shows how much I know 🙂