Fork me on GitHub
#editors
<
2018-05-24
>
pez06:05:04

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

pez06:05:39

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

bozhidar08:05:11

Common functionality for Clojure editors.

bozhidar08:05:00

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

bozhidar08:05:28

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

dominicm08:05:17

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

pez08:05:36

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

bozhidar08:05:11

Well, then you’re using orchard already. 😉

pez08:05:29

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

pez08:05:40

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.

bozhidar08:05:08

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.

pez08:05:36

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

pez08:05:57

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?

pez09:05:13

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

dominicm09:05:35

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

dominicm09:05:00

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

pez09:05:49

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.

pez09:05:53

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

bozhidar09:05:55

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

bozhidar09:05:14

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.

pez09:05:36

Makes total sense.

bozhidar09:05:10

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.

bozhidar09:05:41

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

👍 8
pez09:05:32

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.

dominicm09:05:12

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

dominicm09:05:29

macros throw a spanner into static analysis methods.

bozhidar09:05:36

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.

👍 4
bozhidar09:05:08

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

pez09:05:14

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

dominicm09:05:28

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

bozhidar09:05:38

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

pez09:05:48

Very good FYI, @dominicm, thanks!

dominicm09:05:06

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

bozhidar09:05:01

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.

👍 4
dominicm09:05:34

You can extend LSP with additional functionality.

pez09:05:04

What are some examples on what lispers might miss?

pez09:05:36

Haha, wow.

dominicm09:05:03

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

pez09:05:09

RPL is not that fun.

dominicm09:05:21

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

dominicm09:05:31

I haven't looked into it for a while

bozhidar09:05:52

> You can extend LSP with additional functionality.

bozhidar09:05:49

Ah, didn’t know this.

bozhidar09:05:35

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.

richiardiandrea14:05:57

@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

pez15:05:19

@richiardiandrea I hope someone undertakes it. :face_with_cowboy_hat:

futuro16:05:06

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

futuro16:05:33

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

futuro16:05:30

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

futuro16:05:16

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

richiardiandrea16:05:17

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

richiardiandrea16:05:24

haven't even looked at it

futuro16:05:48

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.

richiardiandrea16:05:57

I want the same...

futuro17:05:12

The nREPL uses some, but cider uses a lot.

futuro17:05:07

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

futuro17:05:24

It’s the dream 😁

richiardiandrea17:05:57

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

futuro17:05:07

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.

richiardiandrea17:05:17

because cider can work with no middleware as well

futuro17:05:52

Yeah, I think so.

richiardiandrea17:05:40

yeah, if I understood @bozhidar correctly

richiardiandrea17:05:55

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

dominicm06:05:31

This one is not well suited to decoding streams, like from the network.

dominicm06:05:55

There's only one I've found that does that, and it can't handle negative numbers.

futuro16:05:59

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

richiardiandrea16:05:11

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

futuro16:05:10

@dominicm what stream decoding bencode library was this?

futuro16:05:47

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

dominicm16:05:13

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

futuro16:05:26

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

richiardiandrea16:05:16

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.

richiardiandrea16:05:31

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

futuro16:05:26

Ahh, fantastic; thanks for digging that up 😄

futuro17:05:59

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.

bozhidar03:05:42

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.

bozhidar03:05:22

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

bozhidar03:05:47

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

dominicm05:05:30

You need a version that works in JavaScript streams.

dominicm06:05:20

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

futuro12:05:17

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.

dominicm12:05:45

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

dominicm12:05:59

there's likely a nodejs generative testing lib.