Discussion about all editors used for Clojure/ClojureScript
pez 2018-05-24T06:04:04.000203Z

@bozhidar: it seems ten thousand messages are exchanged fast. I was going back here to see if I could check up that new tooling thing you posted about the other day, but now it is gone. Can you remind me what it was?

pez 2018-05-24T06:04:39.000193Z

Sorry for being so unspecific, my memory is vague here and there is also the possibility that I misunderstood the whole thing.

bozhidar 2018-05-24T08:13:55.000178Z

@pez https://github.com/clojure-emacs/orchard

bozhidar 2018-05-24T08:14:11.000457Z

Common functionality for Clojure editors.

bozhidar 2018-05-24T08:15:00.000013Z

It’s work in progress, but that’s basically the heart of CIDER nREPL middleware. (and, of course, the middlewares are also editor agnostic)

bozhidar 2018-05-24T08:15:28.000043Z

The idea behind orchard was to share the functionality with non-nREPL clients.

dominicm 2018-05-24T08:16:17.000137Z

@pez your work is based on cider nrepl isn't it? 🙂

pez 2018-05-24T08:16:36.000391Z

@bozhidar Thanks! Appreciated. I'll probably come back with questions. 😃

pez 2018-05-24T08:16:56.000420Z

@dominicm yes

bozhidar 2018-05-24T08:17:11.000527Z

Well, then you’re using orchard already. 😉

pez 2018-05-24T08:45:29.000339Z

Haha, you live and learn. I really need to check it out then.

pez 2018-05-24T08:47:40.000514Z

Btw, @bozhidar, saw your talk from Bulgaria (I think it was) about the bad parts. Awesome stuff. Started watching the Stewardship talk you recommended. Can't wait for a time slot to finish it.

bozhidar 2018-05-24T08:57:08.000233Z

Happy to hear this! Wasn’t my finest talk (was pretty sick at the time of that conference), but I’m glad people find it useful. I should revisit it down the road. I’ve got many ideas on the subject.

pez 2018-05-24T08:58:36.000122Z

I am in my first learning phase of Clojure things, I found it very useful!

pez 2018-05-24T08:58:57.000491Z

So, a noobish question then: we are thinking about ways to support Lumo. Not all that seriously thinking, since it seems a lot of work, but anyway, orchard could maybe help with such an undertaking?

pez 2018-05-24T09:00:13.000186Z

Or, no, maybe it is tied to the JVM and not suitable for selfhosted Javascript stuff?

dominicm 2018-05-24T09:00:35.000463Z

Orchard does aim to smooth over jvm/cljs differences to the degree it makes sense.

dominicm 2018-05-24T09:01:00.000096Z

The support isn't there yet, but I think it's intended that it will integrate the cljs-tooling library.

pez 2018-05-24T09:02:49.000402Z

Sounds great. We have tons of work to do without bringing Lumo into the mix, but I will keep an eye on this development, then.

pez 2018-05-24T09:03:53.000328Z

While at this, have you guys seen any initiatives towards writing a language server (Microsoft style) for Clojure?

bozhidar 2018-05-24T09:06:55.000420Z

Yeah, I’ve seen a couple of projects on GitHub, but I don’t think there’s anything that mature yet.

bozhidar 2018-05-24T09:08:14.000017Z

I guess that lsp for Clojure would mostly be a wrapper around something like nREPL or a socket server and would just reuse existing functionality to provide a new interface.

pez 2018-05-24T09:08:36.000171Z

Makes total sense.

bozhidar 2018-05-24T09:09:10.000217Z

An alternative approach would be to try to do mostly static analysis in a lsp implementation (I think I saw one of those), but I don’t think that’s the way to go given all the work that has gone into building REPL-powered tooling.

bozhidar 2018-05-24T09:10:28.000588Z


bozhidar 2018-05-24T09:10:41.000056Z

That’s the one I saw doing static analysis instead.

pez 2018-05-24T09:11:32.000320Z

We have talked a bit about static analysing. But I think much of the power comes from having that REPL at your fingertips, so anything REPL-powered makes most sense for us.

dominicm 2018-05-24T09:12:12.000502Z

You also get more accurate results by inspecting the actual state, rather than statically "guessing"

dominicm 2018-05-24T09:12:29.000297Z

macros throw a spanner into static analysis methods.

bozhidar 2018-05-24T09:12:36.000128Z

The two approaches are not exclusive of each other, but there’s one fundamental issue with static analysis in Clojure - it’s not that static.

bozhidar 2018-05-24T09:13:08.000257Z

You have to eval the code to know what you’re analyzing, and that’s rarely what the users want.

pez 2018-05-24T09:13:14.000482Z

That one you posted has a POC vscode client, very interesting.

dominicm 2018-05-24T09:13:28.000231Z

@pez it's also coupled to lein, just as an fyi

bozhidar 2018-05-24T09:13:38.000567Z

We do some static analysis with refactor-nrepl and people are often surprised when their namespaces get evaluated “by themselves”.

pez 2018-05-24T09:13:48.000221Z

Very good FYI, @dominicm, thanks!

dominicm 2018-05-24T09:14:06.000178Z

@bozhidar true. I also have had some reports of certain records just not working for unknown reasons.

bozhidar 2018-05-24T09:17:01.000486Z

As for the LSP in general - knowing how wider the protocols for Lisp dev environments are, I wonder if they’ll ever gain a footing in the lisp world. Sure, the basic ops are the most important, but I can imagine that many people would benefit immensely from extra functionality outside the LSP standard.

dominicm 2018-05-24T09:22:34.000344Z

You can extend LSP with additional functionality.

pez 2018-05-24T09:31:04.000257Z

What are some examples on what lispers might miss?

dominicm 2018-05-24T09:31:14.000215Z


pez 2018-05-24T09:31:36.000111Z

Haha, wow.

dominicm 2018-05-24T09:32:03.000464Z

LSP has been designed in the context of rust/c++/etc. which don't really have a repl at all

pez 2018-05-24T09:32:09.000483Z

RPL is not that fun.

dominicm 2018-05-24T09:32:21.000577Z

I might be making that up, but I'm pretty sure it's true

dominicm 2018-05-24T09:32:31.000563Z

I haven't looked into it for a while

bozhidar 2018-05-24T09:44:52.000326Z

> You can extend LSP with additional functionality.

bozhidar 2018-05-24T09:45:49.000157Z

Ah, didn’t know this.

bozhidar 2018-05-24T09:46:35.000043Z

But overall I think you’re right - all of this was created with different languages in mind. In a way for while our “LSP” was been nREPL extended with some extra middleware.

richiardiandrea 2018-05-24T14:26:57.000500Z

@pez about lumo support at the moment there is only a socket REPL. Inf-clojure just sends the form and shows the response..very basic. I have been thinking and @futuro really had this idea, of adding a bencode layer + sessions and support nRepl but it is a daunting task

pez 2018-05-24T15:19:19.000647Z

@richiardiandrea I hope someone undertakes it. :face_with_cowboy_hat:

futuro 2018-05-24T16:56:06.000638Z

We can solve the self-hosted IO problem, and potentially get a single library that nREPL code can use for file system and networking.

futuro 2018-05-24T16:56:33.000400Z

The major hurdle I see still is that the async methodologies are so fundamentally different.

futuro 2018-05-24T16:57:30.000419Z

In the JVM, call future and you’re off to the races. On Node, all of the async involves passing callbacks

futuro 2018-05-24T16:58:16.000787Z

And in JS in general, that’s sort of a hard limit imposed by the JavaScript spec.

richiardiandrea 2018-05-24T16:59:17.000302Z

@futuro does the nrepl code base run a lot of futures?

richiardiandrea 2018-05-24T16:59:24.000319Z

haven't even looked at it

futuro 2018-05-24T16:59:48.000097Z

I really want a self-hosted nREPL server (I really want Cider, tbh) but I won’t have good answers to that question until I face it.

richiardiandrea 2018-05-24T16:59:57.000303Z

I want the same...

richiardiandrea 2018-05-24T16:59:58.000771Z


futuro 2018-05-24T17:00:12.000417Z

The nREPL uses some, but cider uses a lot.

futuro 2018-05-24T17:01:07.000107Z

So a base nREPL server isn’t too hard (the original implementation is very small), but getting cider support will be more work.

futuro 2018-05-24T17:01:24.000742Z

It’s the dream 😁

richiardiandrea 2018-05-24T17:02:57.000481Z

when you say cider I guess you mean cider-nrepl?

futuro 2018-05-24T17:03:07.000739Z

That being said, it probably makes the most sense to look at what operations the cider code supports and remake that from a self-hosted perspective.

richiardiandrea 2018-05-24T17:03:17.000323Z

because cider can work with no middleware as well

futuro 2018-05-24T17:03:52.000715Z

Yeah, I think so.

futuro 2018-05-24T17:04:04.000685Z


richiardiandrea 2018-05-24T17:04:40.000572Z

yeah, if I understood @bozhidar correctly

richiardiandrea 2018-05-24T17:04:55.000708Z

so the first thing would be to get the protocol + sessions going

richiardiandrea 2018-05-24T17:05:29.000234Z

protocol meaning - bencode - https://github.com/themasch/node-bencode

futuro 2018-05-25T16:35:59.000635Z

It can’t handle negative numbers? That’s really curious.

richiardiandrea 2018-05-25T16:43:11.000568Z

does the nrepl protocol use negative numbers? seems like a pretty big defect for such a popular lib

futuro 2018-05-25T16:45:10.000720Z

@dominicm what stream decoding bencode library was this?

futuro 2018-05-25T16:46:47.000274Z

@richiardiandrea bencode is used to serialize all nREPL output/input, so that could include negative numbers from user input, like (* 20 -1)

dominicm 2018-05-25T16:47:19.000231Z


dominicm 2018-05-25T16:48:13.000647Z

There's commonly quite a few subtle bugs where Unicode isn't supported properly and other such things.

futuro 2018-05-25T16:50:26.000699Z

Is that a problem with bencode as a standard, or just implementations?

richiardiandrea 2018-05-25T16:53:16.000163Z

from the bittorrent spec: > Integers are represented by an 'i' followed by the number in base 10 followed by an 'e'. For example i3e corresponds to 3 and i-3e corresponds to -3. Integers have no size limitation. i-0e is invalid. All encodings with a leading zero, such as i03e, are invalid, other than i0e, which of course corresponds to 0.

richiardiandrea 2018-05-25T16:53:31.000418Z

so in the case of negative numbers it is an impl problem

richiardiandrea 2018-05-25T16:56:06.000244Z


futuro 2018-05-25T16:57:26.000523Z

Ahh, fantastic; thanks for digging that up 😄

futuro 2018-05-25T17:22:59.000396Z

I wonder what it'd take for a pure cljs bencode library. All of the clojure libraries I've looked at are tied pretty tightly to the jvm, but multi-methods are a common pattern.

bozhidar 2018-05-29T03:03:42.000111Z

Yeah, I agree. I was surprised to see it was inlined. Probably we should make it just a library under the nREPL org. File a ticket about this.

bozhidar 2018-05-29T03:08:22.000050Z

Even today there are are some portable bencode libraries, but who knows how things were 7 years ago when the project started.

bozhidar 2018-05-29T03:08:47.000022Z

Generally we can’t risk adopting a new library at this point, so I’d rather just extract ours and keep refining it.

richiardiandrea 2018-05-29T03:26:36.000038Z

Done https://github.com/nrepl/nREPL/issues/32

dominicm 2018-05-29T05:27:30.000186Z

You need a version that works in JavaScript streams.

dominicm 2018-05-29T06:54:20.000189Z

That is to say that I think host interop differences might make this harder.

futuro 2018-05-29T12:07:17.000031Z

Trying to combine clj and cljs will probably be hard because of host interop, but having a clj and a cljs library shouldn’t be too hard. That depends, of course, on stream support in abio.

dominicm 2018-05-29T12:37:45.000555Z

node-bencode isn't terrible, and it probably wouldn't take too much work to get it compliant. It has very useful error messages.

dominicm 2018-05-29T12:37:59.000018Z

there's likely a nodejs generative testing lib.