Fork me on GitHub
#unrepl
<
2018-03-12
>
kotarak08:03:36

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.

dominicm08:03:43

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

kotarak09:03:29

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.

kotarak09:03:05

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.

kotarak09:03:30

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.

cgrand09:03:08

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

cgrand09:03:53

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

cgrand09:03:01

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

cgrand09:03:03

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

cgrand09:03:35

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.

cgrand09:03:02

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

cgrand09:03:14

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

cgrand09:03:29

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

cgrand09:03:51

We really need a couple of concrete examples.

kotarak09:03:12

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?

kotarak09:03:20

The blob is then sort of defeated.

kotarak09:03:47

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

kotarak10:03:26

My aesthetics (shiver) don't approve.

kotarak10:03:46

But maybe I misunderstand actions.

cgrand10:03:54

I can’t think about this problem without examples.

kotarak10:03:55

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 :-(

kotarak10:03:05

And I mean user! For their selection of extensions.

cgrand10:03:12

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

kotarak10:03:25

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.

kotarak10:03:23

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

kotarak10:03:46

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

dominicm10:03:38

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

dominicm10:03:34

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

cgrand10:03:45

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”])

kotarak11:03:33

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.

kotarak11:03:38

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

dominicm11:03:33

Why would I do vimscript in unrepl? :thinking_face:

cgrand11:03:08

a clojure lib sending vimscript code to hook up in vimpire

cgrand11:03:03

not saying it’s a good idea

dominicm11:03:09

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

dominicm11:03:18

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

dominicm11:03:35

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

kotarak11:03:59

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

kotarak20:03:09

@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

kotarak20:03:46

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

dominicm20:03:48

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

kotarak20:03:36

Öh. Me has no clue about neovim.

kotarak20:03:45

Do its channels work differently?

kotarak20:03:40

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

kotarak20:03:52

And a ch_close somewhere in the repl.

dominicm20:03:09

it does work differently, yeah

kotarak20:03:16

sigh Why can't we have cookies?

kotarak20:03:20

Very differently?

kotarak20:03:05

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

kotarak20:03:45

Ok. A completion demo is now also up.

dominicm20:03:53

it's callback based.

dominicm20:03:01

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

dominicm20:03:12

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

kotarak20:03:24

It says something about tcp here.

kotarak20:03:04

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

kotarak20:03:28

Seriously underwhelming.

kotarak20:03:13

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

dominicm21:03:28

shows how much I know 🙂