unrepl

discussing specification of an edn-based repl and its implementations.
richiardiandrea 2017-12-31T00:24:35.000017Z

@volrath @bozhidar I was exploring the spiral project as I was looking for a way to better handle async stuff in emacs (not an emacs guru here, but so like elisp). The state machine approach of spiral is nice and I was wondering if I could include it in inf-clojure. Then I thought...maybe the two can become one? Basically text or unrepl protocol...the operations are the same...of course in case of text you would have only one connection. Probably more things are different, but are the two SO different? Will think more.

volrath 2017-12-31T00:44:52.000019Z

@richiardiandrea we started an issue to discuss possible merging of spiral into cider https://github.com/Unrepl/spiral/issues/5, I know it's not exactly what you are talking about, but it can give you an idea of both our perspectives on the subject. My current situation is that I'll be all forward to integrate spiral into a wider used tool like cider (or inf-clojure maybe), although I still feel it's quite a big amount of work that I'm not sure I could commit to. Besides the difference on the protocol, the other big things are: 1. spiral uses parseclj ast data structures to process/handle messages from the running repl, cider uses nrepl-client, inf-clojure I don't know (haven't read the source code, but I'm guessing it's just plain text?), and 2. tooling is handled differently, I've been thinking on using cider-nrepl as a libraryfor certain features in spiral (and that way make it easier for a possible integration later on) but at some points I've felt that cider-nrepl is a big library that I would have to load for a small amount of features that can actually be ported between each other.. this is something that I recently started to look into, so I don't have a well formed opinion on this yet. Besides these, I've been putting thought into certain UI/UX decisions into spiral, that are highly opinionated, and that makes it as a possible alternative to cider.

volrath 2017-12-31T00:46:49.000039Z

btw, while I have you here, I took a look at https://github.com/Unrepl/unravel/issues/64 and boot-sources, great work! it's definitely something that could be useful for unravel/spiral.. I haven't really checked on mranderson too much either

richiardiandrea 2017-12-31T00:47:01.000008Z

Iirc a library like cider-nrepl should be loaded by using sideloading, or we are back again to middleware problems? In any case will read the issues

richiardiandrea 2017-12-31T00:47:44.000018Z

Yes btw I worked on the compliment blob, which I built using boot, I plan to dig into that as well

richiardiandrea 2017-12-31T00:48:15.000066Z

Will keep digging and thinking :)

volrath 2017-12-31T00:49:13.000065Z

sounds great, I will update the collaboration issue with some thoughts tomorrow, feel free to join there if you have ideas on how to move forward 🙂

volrath 2017-12-31T00:51:23.000054Z

re. cider-nrepl, I was thinking on just sideloading it and using it as a library, without really using the middlewares... you can take a look at https://github.com/Unrepl/spiral/blob/master/tools/src/spiral/tools/load_file.clj (which was my first try out at unrepl custom session actions) and compare it to cider-nrepl load middleware

volrath 2017-12-31T00:51:46.000013Z

it's basically the same, minus the nrepl middleware stuff

volrath 2017-12-31T00:52:11.000077Z

and that code is just sideloaded using the unrepl sideloading feature

richiardiandrea 2017-12-31T02:11:50.000021Z

Yep that is the approach I had in mind too

bozhidar 2017-12-31T07:52:44.000027Z

For something like this it’d be best if cider-nrepl is split into two - something like`cider` + cider-nrepl. One is just an utility library for Clojure tooling, the other is just an nREPL wrapper around the first one. There’s very little nREPL-specific code in cider-nrepl - just middleware definitions and handlers.

bozhidar 2017-12-31T07:53:22.000072Z

> Besides the difference on the protocol, the other big things are: 1. spiral uses parseclj ast data structures to process/handle messages from the running repl, cider uses nrepl-client, inf-clojure I don’t know (haven’t read the source code, but I’m guessing it’s just plain text?),

bozhidar 2017-12-31T07:54:13.000008Z

parseclj simply didn’t exist at the time. In general EDN didn’t exist when nREPL was created, therefore the decision to use bencode for the communication with the clients - it was something easy to support in many editors.

bozhidar 2017-12-31T07:55:53.000030Z

Even now nREPL can be extended with some EDN adapter if someone wants to work in this direction, and I do plan to use parseclj once the package is released officially for parsing data structures (now we just parse them with the Elisp reader, which is problematic here and there).

bozhidar 2017-12-31T07:58:01.000042Z

What’s the advantage of using boot-sources over mranderson? I’ve seen several source rewriting tools over the years and they all seem to do pretty much the same thing.

bozhidar 2017-12-31T08:00:09.000043Z

Btw, that rewriting is what actually makes cider-nrepl rather big as an artefact - it bundles all of its runtime deps with it. That’s why in the latest version we opted to simply defer the loading of everything until it’s used, otherwise the load time was quite significant. Now it’s around 0.

bozhidar 2017-12-31T08:32:41.000037Z

Also, cider-nrepl is just half of the equation. A lot of extra CIDER features reside in clj-refactor.el and refactor-nrepl. Some of them will eventually be promoted to CIDER, but I haven’t had much time for this lately. And there’s also cljs-tooling where we’ve extracted most of the cljs-related code we have.

bozhidar 2017-12-31T08:33:29.000023Z

Part of the reason cljs support is CIDER is so bad is that the two people who were working on cljs-tooling eventually stopped having time for the project. 😞 I think they were off to a great start.

dominicm 2017-12-31T08:57:18.000010Z

I think rewriting will continue to be a requirement for unrepl.

pesterhazy 2017-12-31T08:58:00.000035Z

Some refactorings are part of clojure-mode these days, right?

pesterhazy 2017-12-31T08:59:50.000050Z

Ideally they shouldn’t require a real connection at all. If that’s feasible...

pesterhazy 2017-12-31T09:00:21.000055Z

@dominicm what do you mean by rewriting?

volrath 2017-12-31T09:02:53.000009Z

> For something like this it’d be best if cider-nrepl is split into two - something like`cider` + cider-nrepl. One is just an utility library for Clojure tooling, the other is just an nREPL wrapper around the first one. There’s very little nREPL-specific code in cider-nrepl - just middleware definitions and handlers. 100%. Lately I've started looking at writing support for eldoc in spiral, and i feel like I would end up reusing lots of cider-nrepl's code, but it be easier if it were split like you say. Splitting cider-nrepl would be one of the things that I think we should add to a TODO list for a possible integration of spiral into cider.

volrath 2017-12-31T09:03:55.000002Z

> parseclj simply didn’t exist at the time. In general EDN didn’t exist when nREPL was created, therefore the decision to use bencode for the communication with the clients - it was something easy to support in many editors. yes, parseclj started this year, around June if I remember correctly, but the project is a bit stalled right now, hopefully it will pick up soon.

volrath 2017-12-31T09:09:30.000047Z

@bozhidar I haven't looked at the latest changes in cider-nrepl, with the deferred loading and all, but isn't that a step forward to splitting the library? how difficult would it be to actually do the split, in your opinion?

volrath 2017-12-31T09:10:29.000049Z

and I also don't understand what's the meaning of "rewriting"

bozhidar 2017-12-31T10:21:31.000042Z

Rewriting the namespace. 🙂 Guess I could have used a different word, but basically such tools just copy the original source code with a different namespace, as a simple way to avoid conflict with a different version of the same library being loaded by the user.

bozhidar 2017-12-31T10:21:45.000049Z

> @bozhidar I haven’t looked at the latest changes in cider-nrepl, with the deferred loading and all, but isn’t that a step forward to splitting the library? how difficult would it be to actually do the split, in your opinion?

bozhidar 2017-12-31T10:22:46.000030Z

Should be much. Probably a few days of focused work, something like this. The hardest part would likely be to define the right API for the shared library, although obviously you don’t have to get this right from day 1.

volrath 2017-12-31T10:29:38.000017Z

> Rewriting the namespace. 🙂 Guess I could have used a different word, but basically such tools just copy the original source code with a different namespace, as a simple way to avoid conflict with a different version of the same library being loaded by the user. I see. then @dominicm is right, unrepl clients also need this. I haven't used mranderson yet, I will check it out

dominicm 2017-12-31T10:32:02.000017Z

Some people call it "vendoring"

dominicm 2017-12-31T10:32:16.000005Z

Shading is what maven calls it I believe.

dominicm 2017-12-31T10:32:36.000047Z

> This plugin provides the capability to package the artifact in an uber-jar, including its dependencies and to shade - i.e. rename - the packages of some of the dependencies. From maven-shade-plugin

dominicm 2017-12-31T10:32:46.000005Z

> then @dominicm is right, I usually am :troll:

😄 1
pesterhazy 2017-12-31T10:34:56.000029Z

From Rich's talk the Value of Value >>> [...] just listen to Paulus [...]

volrath 2017-12-31T10:36:02.000022Z

I remember that part, then he followed with "... and do the opposite", right?

pesterhazy 2017-12-31T10:36:42.000040Z

🙃

volrath 2017-12-31T10:36:50.000066Z

😄

pesterhazy 2017-12-31T11:44:21.000004Z

If anyone is on macOS, please give the new homebrew formula a spin: https://github.com/Unrepl/unravel#simple-installation

cgrand 2017-12-31T15:28:16.000046Z

When?

bozhidar 2017-12-31T16:27:40.000029Z

@pesterhazy bash: line 29: exec: clojure: not found

bozhidar 2017-12-31T16:28:15.000059Z

Not sure if you didn’t want to use clj. I don’t recall ever seeing a clojure script.

bozhidar 2017-12-31T16:29:33.000047Z

> with the deferred loading and all, but isn’t that a step forward to splitting the library?

bozhidar 2017-12-31T16:32:26.000044Z

I forgot about this question. No, it’s mostly a workaround for nREPL eagerly loading all middleware instead of loading them when they are first needed. This makes the process of inspecting the server capabilities easier, but affects the server’s boot time when you have some big dependencies. Ideally something like this would land in nREPL itself after 0.3, but it was relatively easy for us to cook a something don’t requiring upstream changes - we just define some dummy middlewares that load the real ones on their first usage.

pesterhazy 2017-12-31T16:34:16.000073Z

@bozhidar

$ brew list clojure
/usr/local/Cellar/clojure/1.9.0.273/bin/clj
/usr/local/Cellar/clojure/1.9.0.273/bin/clojure

bozhidar 2017-12-31T16:34:41.000033Z

haha

pesterhazy 2017-12-31T16:34:43.000054Z

clj is just a wrapper around clojure that adds rlwrap (which we don't want)

bozhidar 2017-12-31T16:35:00.000048Z

OK, now I know what went wrong. Seems you didn’t add a dependency to the clojure recipe.

pesterhazy 2017-12-31T16:35:02.000115Z

have you installed the clojure tool some other way?

bozhidar 2017-12-31T16:35:12.000008Z

brew list clojure
Error: No such keg: /usr/local/Cellar/clojure

pesterhazy 2017-12-31T16:35:19.000003Z

hm that's a good point, I should add that!

pesterhazy 2017-12-31T16:40:32.000072Z

@bozhidar do you know how to remove a tap?

pesterhazy 2017-12-31T16:40:55.000091Z

homebrew is not the most logical package manager

pesterhazy 2017-12-31T16:41:47.000035Z

brew untap

bozhidar 2017-12-31T16:42:17.000005Z

😄

pesterhazy 2017-12-31T16:44:05.000068Z

@bozhidar, ok brew upgrade unrepl/bin/unravel should pull in clojure as well

richiardiandrea 2017-12-31T17:35:58.000040Z

I feel I am always late to the party :) Another big thing to consider is different repl types. Inf-clojure supports potentially many because we detect and dispatch accordingly. This makes things really flexible. I can hack on a new repl just with a setq.

richiardiandrea 2017-12-31T17:36:15.000004Z

Plus support for new repls is trivial

richiardiandrea 2017-12-31T17:36:35.000013Z

Cider supports only Clojure basically, a bit of cljs..

richiardiandrea 2017-12-31T17:38:37.000052Z

It would be awesome if we followed inf-clojure's very flexible and pluggable way to treat different Repls

volrath 2017-12-31T23:41:55.000056Z

It is 2018 on this side of the world, so happy new year to everyone!! 🎉 let's make this a great year for clojure tooling =)