Fork me on GitHub
#unrepl
<
2017-12-31
>
richiardiandrea00:12:35

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

volrath00:12:52

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

volrath00:12:49

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

richiardiandrea00:12:01

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

richiardiandrea00:12:44

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

richiardiandrea00:12:15

Will keep digging and thinking :)

volrath00:12:13

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 🙂

volrath00:12:23

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

volrath00:12:46

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

volrath00:12:11

and that code is just sideloaded using the unrepl sideloading feature

richiardiandrea02:12:50

Yep that is the approach I had in mind too

bozhidar07:12:44

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.

bozhidar07:12:22

> 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?),

bozhidar07:12:13

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.

bozhidar07:12:53

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

bozhidar07:12:01

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.

bozhidar08:12:09

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.

bozhidar08:12:41

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.

bozhidar08:12:29

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.

dominicm08:12:18

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

pesterhazy08:12:00

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

pesterhazy08:12:50

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

pesterhazy09:12:21

@dominicm what do you mean by rewriting?

volrath09:12:53

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

volrath09:12:55

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

volrath09:12:30

@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?

volrath09:12:29

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

bozhidar10:12:31

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.

bozhidar10:12:45

> @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?

bozhidar10:12:46

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.

volrath10:12:38

> 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

dominicm10:12:02

Some people call it "vendoring"

dominicm10:12:16

Shading is what maven calls it I believe.

dominicm10:12:36

> 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

dominicm10:12:46

> then @dominicm is right, I usually am troll

pesterhazy10:12:56

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

volrath10:12:02

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

pesterhazy11:12:21

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

bozhidar16:12:40

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

bozhidar16:12:15

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

bozhidar16:12:33

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

bozhidar16:12:26

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.

pesterhazy16:12:16

@bozhidar

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

pesterhazy16:12:43

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

bozhidar16:12:00

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

pesterhazy16:12:02

have you installed the clojure tool some other way?

bozhidar16:12:12

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

pesterhazy16:12:19

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

pesterhazy16:12:32

@bozhidar do you know how to remove a tap?

pesterhazy16:12:55

homebrew is not the most logical package manager

pesterhazy16:12:05

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

richiardiandrea17:12:58

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.

richiardiandrea17:12:15

Plus support for new repls is trivial

richiardiandrea17:12:35

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

richiardiandrea17:12:37

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

volrath23:12:55

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