This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-22
Channels
- # announcements (2)
- # babashka (18)
- # beginners (87)
- # calva (22)
- # chlorine-clover (5)
- # cider (11)
- # clj-kondo (10)
- # clojure (71)
- # clojure-austin (1)
- # clojure-norway (6)
- # clojure-uk (13)
- # clojurescript (3)
- # core-async (10)
- # data-science (17)
- # datascript (1)
- # datomic (22)
- # emacs (10)
- # fulcro (32)
- # hoplon (8)
- # jobs-discuss (2)
- # malli (5)
- # meander (5)
- # nrepl (35)
- # off-topic (8)
- # pathom (38)
- # planck (21)
- # re-frame (10)
- # reagent (17)
- # reitit (7)
- # shadow-cljs (26)
- # tools-deps (3)
- # xtdb (7)
I have a quick question about the nrepl protocol. Is there a concept of a langauge when connected to a nrepl server? Whenever I see nrepl implemented for Clojurescript, it's always like a side channel thing that takes over the session that the client has to side effect. The client can't easily ask what language it's connected to over nrepl.
I ask this because in implementing a native clojurescript nrepl server, I can't seem to find any clients (vim-fireplace, calva, etc.) that work out of the box, they all assume clojure and have specific hacks for piggieback, figwheel and shadow-cljs.
> I have a quick question about the nrepl protocol. Is there a concept of a langauge when connected to a nrepl server?
Currently there’s nothing like this, but it can easily be added to the session metadata (for instance).
> Whenever I see nrepl implemented for Clojurescript, it’s always like a side channel thing that takes over the session that the client has to side effect. The client can’t easily ask what language it’s connected to over nrepl.
To my knowledge there are no ClojureScript implementation of nREPL, so I’m a bit puzzled as to what you’re referring to. Piggieback simply changes a regular evaluation session to use the ClojureScript compiler, but it’s still written in Clojure. Therefore the need for clients to look for certain bindings in the session and determine whether it’s Clojure or ClojureScript session.
If we had native ClojureScript servers the clients would know they connected to one and there wouldn’t really be a need to query about the language, although I understand this might be useful in certain cases.
Obviously with a native ClojureScript server you won’t be able to host both Clojure and ClojureScript REPLs in the same server, but I doubt that’s an issue for most people .
> I ask this because in implementing a native clojurescript nrepl server, I can’t seem to find any clients (vim-fireplace, calva, etc.) that work out of the box, they all assume clojure and have specific hacks for piggieback, figwheel and shadow-cljs. Because so far there hasn’t been an alternative. 🙂 Are you working on a native ClojureScript implementation?
I started working on an nrepl server prototype that ran on lumo/nodejs last year and ran into these issues. I got busy with some other stuff but was inspired by https://www.youtube.com/watch?v=dZ4xczP5zDI to start looking into it again.
It's a very rough prototype https://github.com/djblue/nrepl-cljs
I’m hear to help if you need me. Btw, on a similar note - @borkdude just started to work on nREPL for babashka!
The best part is probably https://github.com/djblue/nrepl-cljs/blob/master/src/nrepl/bencode.cljs
Although setting up a proxy https://github.com/djblue/nrepl-cljs/blob/master/src/nrepl/proxy.cljs and logging message with an existing implementation is really helpful :thumbsup:
It would be really cool if you made the nrepl_server.clj a cljc file and made the transport platform specific!
Also found https://github.com/borkdude/nrepl-server#reverse-engineering-the-nrepl-protocol, so it seems we have done very similar things 😆
Vim-fireplace, calva, and other editors which act as clients don't require a jvm right?
They usually just connect to the server via something like python or typescript based on the editor
I don't think you will run into as many problems as I did because babashka is more clojure than clojurescript.
There are also OCaml, Python and Ruby clients for nREPL, btw. Probably some others as well, I never tried to keep track of all of them.
@bozhidar I'm trying to use nrepl/bencode with babashka which is compiled with GraalVM. GraalVM doesn't like this part:
https://github.com/nrepl/bencode/blob/04287269237788811ee4726d5a51db72d5d600d1/src/bencode/core.clj#L317
Since 1.9 Clojure has a bytes?
predicate:
(defn bytes?
"Return true if x is a byte array"
{:added "1.9"}
[x] (if (nil? x)
false
(-> x class .getComponentType (= Byte/TYPE))))
Maybe we could use that in bencode?