unrepl

discussing specification of an edn-based repl and its implementations.
cgrand 2017-08-01T14:10:23.351998Z

Pondering: 1/ should we worry about concurrent server implementations extension interop for the same platform? (forks) 2/ should we worry about extension interop between server impl for different platforms? (cljs, cljs, cljsjs, cljr...)

richiardiandrea 2017-08-01T14:13:26.468258Z

Imho we need to start from somewhere, so I'd start from 1, still keeping 2 in the back of our head

cgrand 2017-08-01T14:15:22.542530Z

edited my questions, do you maintain your position?

cgrand 2017-08-01T14:16:19.579303Z

mine is “forget 1 and keep 2 in mind”

richiardiandrea 2017-08-01T14:17:05.608457Z

put it this way, 1 seems to be a subcase of 2 (if done correctly)

richiardiandrea 2017-08-01T14:17:32.625541Z

(if I understand correctly of course)

cgrand 2017-08-01T14:17:32.625841Z

I didn’t considered it but yes

cgrand 2017-08-01T14:18:37.667848Z

in cloiure it’s easy to start an extended repl by calling clojure.main/repl, why not follow this lead?

richiardiandrea 2017-08-01T14:19:41.709360Z

I like the idea, yes, but also you don't want to call a function for everything you want to add to it...

cgrand 2017-08-01T14:19:51.716114Z

the big cons to the clojure approach is that you don’t have access to the current extensions (eg if you just want to modifiy prompt), so it calls for some dynamic env

richiardiandrea 2017-08-01T14:20:14.730572Z

so for completion you should not need a compliment.core/repl function

cgrand 2017-08-01T14:20:24.737007Z

what do you mean by > call a function for everything you want to add to it

richiardiandrea 2017-08-01T14:21:23.774809Z

But I think there is going to be a clojure.cljs/repl

cgrand 2017-08-01T14:22:01.798445Z

what about (unrepl.repl/repl :action {:complete ...})?

richiardiandrea 2017-08-01T14:22:45.825833Z

yes, so nRepl has descriptors, that would resemble it

richiardiandrea 2017-08-01T14:22:59.835080Z

I declare which actions the repl would understand

cgrand 2017-08-01T14:23:11.842931Z

the map would be merged with current one

cgrand 2017-08-01T14:23:42.862704Z

extensions could then occur on the fly

richiardiandrea 2017-08-01T14:24:15.884647Z

yep I like the idea, I think that part of nRepl was actually good, I guess you are more than familiar with it 😄

cgrand 2017-08-01T14:25:00.913487Z

no or if I got involved I suffer from post-coding amnesia

cgrand 2017-08-01T14:26:41.978163Z

or (alter-var-root! unrepl.repl/*actions* into {:complete ...})

richiardiandrea 2017-08-01T14:28:59.067982Z

the latter is more dynamic, why not an atom?

cgrand 2017-08-01T14:29:06.072589Z

middleware deps hell

cgrand 2017-08-01T14:29:24.083870Z

because we want to keep it local to the session?

richiardiandrea 2017-08-01T14:30:46.139193Z

yeah the problem of namespace munging comes back

cgrand 2017-08-01T14:31:24.164816Z

on the jvm we can go nuclear and spawns a separate clojure in its own classloader

cgrand 2017-08-01T14:31:32.170041Z

(not good for latency, hey boooot!)

richiardiandrea 2017-08-01T14:31:44.177893Z

lol yes, pods in boot are superslow

richiardiandrea 2017-08-01T14:32:01.188589Z

(to bootstrap I mean)

dominicm 2017-08-01T14:32:55.223543Z

I thought we get to blame clojure for it being slow? 😉

richiardiandrea 2017-08-01T14:33:16.237711Z

well if Clojure is slow than Clojure in Clojure (pods) what is it 🙂 ?

dominicm 2017-08-01T14:36:25.359632Z

@cgrand https://docs.google.com/document/d/1dnb1ONTpK9ttO5W4thxiXkU5Ki89gK62anRqKEK4YZI/edit?authkey=CMuszuMI you've been named as involved. It's too late now.

cgrand 2017-08-01T14:38:59.458135Z

that’s why I never answer Chas emails anymore 😉

cgrand 2017-08-01T14:40:49.528007Z

and I would rather blame clojure for making namespaces a mutability hell (Zach Tellmann has some name for that “clojure nasty mutability closet” or something)

richiardiandrea 2017-08-01T14:41:36.559115Z

so in the above, what is the content of the :complete key? a simbol that points to the completion function?

cgrand 2017-08-01T14:42:36.597335Z

munging: let’s assume we live in a hickeyic world where libs only ever accrete features?

richiardiandrea 2017-08-01T14:43:18.625391Z

yes I liked the merkle tree for namespaces 😉

richiardiandrea 2017-08-01T14:44:32.672577Z

maybe obvious here, I assume the client will not know about that

cgrand 2017-08-01T14:44:47.682847Z

:complete would map to a message template

richiardiandrea 2017-08-01T14:45:02.692227Z

oh ok cool

cgrand 2017-08-01T14:46:39.757662Z

so it doesn’t say a thing about how namespaces are loaded. (the dreaded namespace talk)

richiardiandrea 2017-08-01T14:47:31.791503Z

yeah well, at some point the munged namespace needs to go back to the client

cgrand 2017-08-01T14:47:56.808169Z

Which munged namespace?

richiardiandrea 2017-08-01T14:48:09.816058Z

or a mapping is done server side

richiardiandrea 2017-08-01T14:48:31.830571Z

say the munged compliment.core

richiardiandrea 2017-08-01T14:49:01.850106Z

server and client need to sync, either they speak unmunged or they speak munged (no?)

richiardiandrea 2017-08-01T14:50:00.888610Z

(sorry corrections)

cgrand 2017-08-01T14:50:14.897497Z

one approach could be [unrepl blob, including completion actions][munged compliment]

cgrand 2017-08-01T14:50:30.908471Z

to me munging is static

cgrand 2017-08-01T14:51:02.930315Z

btw what do you think of my content-based munging idea?

richiardiandrea 2017-08-01T14:51:35.952044Z

it is super, also against tampering (if we wanted to)

cgrand 2017-08-01T14:53:00.009906Z

so you munged compliment.core to compliment.core$sha1$djsfhbehsdbfhb

richiardiandrea 2017-08-01T14:53:52.045223Z

is it a question? if so, not yet

cgrand 2017-08-01T14:54:08.055632Z

(what’s the limit on classname length? well Spring existence proves we have ample room)

cgrand 2017-08-01T14:54:29.070010Z

sorry it was an hypothesis

👍 1
cgrand 2017-08-01T14:55:09.096545Z

so you munged it statically and certainly also unrepl.complete which uses it while exposing a smaller api

richiardiandrea 2017-08-01T14:56:43.159823Z

at the moment forms are sent over the wire in unravel: https://github.com/Unrepl/unravel/blob/compliment-blob/src/unravel/loop.cljs#L76

cgrand 2017-08-01T14:57:48.203933Z

[unrepl blob, with actions referring to unrepl.complete$sha1$.../xxx][munged compliment and complete]`

richiardiandrea 2017-08-01T14:57:58.211115Z

if we had a :complete command action it would be different yep

richiardiandrea 2017-08-01T14:58:40.239557Z

in that case the action would call the munged ns and send back stuff

richiardiandrea 2017-08-01T14:59:10.259547Z

should work, I don't see big obstacles (right now)

cgrand 2017-08-01T14:59:12.261056Z

actions make (I hope) lazy loading easier and interop between client and server easier. (edit: plus in case of doubt let’s have another level of indirection 😉)

richiardiandrea 2017-08-01T14:59:53.288898Z

even better, clients can choose what to lazy load

richiardiandrea 2017-08-01T15:00:12.302035Z

the action can be protected behind a delay

cgrand 2017-08-01T15:00:50.329703Z

now the template could be (unrepl.repl/dyncall 'unrepl.complete$sha1$.... ..) with dyncall ensuring the namespace is loaded beforehand

👍 1
cgrand 2017-08-01T15:01:38.362568Z

[unrepl blob, with lazy activated actions, and side-loading]

cgrand 2017-08-01T15:02:19.390246Z

ensuring which ns are preloaded would just be emitting a require

richiardiandrea 2017-08-01T15:07:47.610431Z

it improves a lot of what nRepl at the moment does (but cider-nrepl folks will soon start adding delays)

richiardiandrea 2017-08-01T15:09:48.688196Z

also, in this case the whole current nRepl middleware could be blobified and transformed in actions

richiardiandrea 2017-08-01T15:10:45.725716Z

which is very appealing

richiardiandrea 2017-08-01T15:10:57.733854Z

but wait...maybe I am missing something about munging

richiardiandrea 2017-08-01T15:11:19.747525Z

if it is content based...would all the clients end up with the same sha1?

cgrand 2017-08-01T15:19:44.077862Z

if all versions are aligned yes

cgrand 2017-08-01T15:20:22.102540Z

so cavalier extensions of protocols or multimethods or usage of atoms may be problematic. (more than now?)

richiardiandrea 2017-08-01T15:38:18.817373Z

atoms in the blob you mean? why?

cgrand 2017-08-01T15:42:23.975713Z

if you have an atom in a lib and you modify it thinking you are the only user...

richiardiandrea 2017-08-01T15:45:58.113815Z

uhm right, I had in the back of my head to have a session-based munging actually...

richiardiandrea 2017-08-01T15:46:26.132410Z

you could put the atom in a session-based munged ns and that is only yours

cgrand 2017-08-01T15:47:43.182354Z

I’m talking about atoms in random libs

👍 1
cgrand 2017-08-01T15:47:54.189121Z

not session state

cgrand 2017-08-01T15:56:25.523437Z

at some point per-connection ns (with automatic removal) was considered for socket repl if memory serves me

richiardiandrea 2017-08-01T15:59:01.627272Z

if we munged all the namespaces involving session, all those vars would effectively be available to the session only (even libs right?)...just throwing it there, haven't thought about implications

cgrand 2017-08-01T16:03:32.805645Z

what are we trying to achieve? maximal protection against badly written code used by extensions?

cgrand 2017-08-01T16:04:03.826027Z

if we are already protected from conflicting with application code, it’s a good enough protection for me

richiardiandrea 2017-08-01T16:04:27.841238Z

no well, but your concern is valid, if a library is stateful, the state will be reflected to all the clients

richiardiandrea 2017-08-01T16:05:02.863502Z

an example would be tools.namespace

cgrand 2017-08-01T16:10:31.062234Z

What's the problem with it?

richiardiandrea 2017-08-01T16:17:48.322227Z

not saying we cannot solve this, just putting it there...this is a pretty common thing that a user would want to do in a repl

cgrand 2017-08-01T17:59:38.907529Z

@richiardiandrea true but it's not a class of problems that is made worse by unrepl.