Fork me on GitHub
#chlorine
<
2020-02-24
>
sparkofreason13:02:59

Made some progress on using Reveal (would have been more straightforward except I was typing vlaad instead of vlaaad, amongst other things 🤪). Now it does start, but when I try to connect Chlorine it gives a bunch of errors like

Clojure 1.10.1
Syntax error reading source at (REPL:1:3).
Conditional read not allowed

(:cljs :using-cljs-repl :clj :using-clj-repl :cljr :using-cljr-repl :joker :using-joker-repl :clje :using-clje-repl :bb :using-bb-repl)
Execution error (IllegalArgumentException) at user/eval3943 (REPL:1).
Wrong number of args passed to keyword: :cljs

:using-unknown-repl
=> :using-unknown-repl
Syntax error reading source at (REPL:3:74).
Conditional read not allowed
The alias I'm using looks like
:reveal {:extra-deps {vlaaad/reveal {:mvn/version "0.1.0-ea4"}}
           :jvm-opts ["-Dclojure.server.repl={:port,50505,:accept,vlaaad.reveal.prepl/-main}"]}
I'm guessing this is something to do with Chlorine initializing the connection? Maybe https://clojure.atlassian.net/projects/CLJ/issues/CLJ-2453? Running from the command line directly seems to work fine.

seancorfield16:02:32

@dave.dixon Chlorine expects a standard socket repl -- you're starting a prepl I think?

sparkofreason16:02:49

Reveal is. @vlaaad is looking into starting a standard repl. See https://github.com/vlaaad/reveal/issues/2

mauricio.szabo16:02:26

Yes, that's probably the problem. When Chlorine connects, the first thing it does is send a form to detect which clojure "flavor" is running

seancorfield16:02:19

Right. I was going to suggest starting Reveal's regular main and also starting a standard socket REPL -- that's how we work with REBL.

seancorfield16:02:34

Reveal needs an API to "submit" form/value data so that you can programmatically add things to its browser.

seancorfield16:02:15

Given that it has nrepl Middleware that should be in place already -- you can probably see what function needs to be called.

vlaaad16:02:31

I've been summoned :)

vlaaad16:02:36

There is no regular main in Reveal, but I'm going to add normal REPL without prepl backend. FYI, there is no static REBL-like submit function, but calling vlaaad.reveal.ui/make will return a function that can be used to submit values. Then making it static is just a matter of def-ing it where you want

vlaaad16:02:37

Created #reveal channel for Reveal-specific discussions

mauricio.szabo17:02:49

Hey @vlaaad! I was just about to send you a message! Good to see you here. I think your project and Chlorine have lots of common ground. The only thing is that reveal is just Clojure, right? Any plans to implement a cljs version?

mauricio.szabo17:02:58

For example, lots of people ask me for a way to navigate the rendered result with the keyboard, or to search parts of the result with a string...

vlaaad17:02:10

I think one of the biggest strengths of tools like Reveal is being in-process: it can effortlessly keep references to objects, which allows lots of meaningful inspections. Cross-process is bound to be limited by serialization, that's why I don't have plans to explore clojurescript support. With that said, since Reveal can prepls, and can receive prepls as parameters, it can already connect to cljs environments

vlaaad17:02:21

It's just not documented :)

avi22:02:44

I apologize if this is a FAQ… is there a known issue related to loading a file using Chlorine, then switching to the REPL in the terminal and attempting to call a fn in a var in the loaded namespace and getting this:

user=> (my-ns/my-fn)
Execution error (IllegalStateException) at unrepl.core/non-eliding-write (REPL:31).
Attempting to call unbound fn: #'unrepl.core/write
?

avi22:02:02

(Atom 1.44.0, Chlorine 0.4.10, MacOS 10.15.1, Clojure 1.10.1.510, JRE 13.0.2)

mauricio.szabo22:02:04

Wow, I never saw this issue. What are the steps to reproduce?

mauricio.szabo22:02:59

(I think I saw Sean having this problem, but evaluating inside Chlorine. It'll be wonderful if I can reproduce it 🙂)

avi22:02:11

Well first I launch my repl from the shell/terminal

avi22:02:21

then launch atom, connect chlorine

avi22:02:25

then load the open file

avi22:02:39

then switch to terminal and attempt to call one of the functions in the file

seancorfield22:02:28

Ah, I'm "glad" someone else has run into that problem! I was never able to track down how to repro, and it hasn't happened since I last mentioned it in this channel!

😅 1
avi22:02:29

happy to screen-share or whatever to help debug

avi22:02:38

screen recording?

mauricio.szabo22:02:18

There's no open issue, I'll be glad if you open it with the screen recording! I'll update to Java 13 and see if I can reproduce here (please, when you open the issue, run java -version so I can see the exact Java version)

seancorfield22:02:38

I ran into it on Adopt OpenJDK 11.

avi22:02:04

openjdk version "13.0.2" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.2+8)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.2+8, mixed mode, sharing)

mauricio.szabo22:02:51

Somehow I can't reproduce on Linux (just installed OpenJDK 13.0.2). I'm hoping is not something specific of some O.S. (I saw some issues on MacOSX before, but they were unrelated to JDK / Clojure REPL)

avi22:02:09

Most likely PEBKAC and I’m wasting your time 😬

avi22:02:38

I can’t add a screen recording right now but happy to do so tomorrow if that’d help

seancorfield22:02:43

@mauricio.szabo How does the "break evaluation" piece work in Chlorine?

mauricio.szabo22:02:56

When I start an evaluation, UNREPL sends me a code that can be used to stop the evaluation. So, I use another connection to the socket REPL and send this command to stop the evaluation

seancorfield22:02:01

Over in the #clojure-dev channel, we are talking about prepl not supporting interruptible evals, and @ghadi mentioned that nREPL's way of handling it -- calling Thread/stop -- is "broken" so I wondered about Chlorine/unrepl.

mauricio.szabo22:02:21

UNREPL runs all code on (future ....)

mauricio.szabo22:02:35

So it just cancels the future

mauricio.szabo22:02:58

@aviflax can you send me the full contents of the editor when you tried to load-file?

avi22:02:31

I can point you to the repo, let me just make sure I can reproduce on master (as opposed to the branch I’m working on that’s currently local only)

avi22:02:45

(I just added my deps.edn aliases to the issue)

avi22:02:10

oh weird, it seems to work fine on master

avi22:02:34

so the cause must be discernible in the branch diff

avi22:02:36

confirmed

avi22:02:06

I might just push the branch and point you to the diff

avi22:02:17

(I’ve added that to the issue as well)

mauricio.szabo23:02:05

@aviflax thanks a lot! I can reproduce this issue just fine! I'll see if there's a fix, or if it's some error with UNREPL 🙂

avi23:02:42

@mauricio.szabo I’ve got another commit on that branch, locally… in which I fixed the new code, which means the tests are no longer failing. I thought I’d see if the unrepl problem still occurs, and it does not

avi23:02:57

I can push that commit if that’d be helpful to you, or hold off, whatever’s more helpful

mauricio.szabo23:02:20

Yes, I just found the issue too...

mauricio.szabo23:02:25

For some reason, the output stream of clojure.test does not redirect to the socket. Just after connecting, Chlorine does the redirection right here: https://github.com/mauricioszabo/repl-tooling/blob/master/src/repl_tooling/repl_client/clojure.cljs#L155-L157

avi23:02:39

well that’s good!

avi23:02:41

…right?

mauricio.szabo23:02:11

Yes, that's good. When I re-issue this command, it works So, probably what I'll do is re-bound this variable from time to time... maybe? 😄

avi23:02:18

😬

avi23:02:42

gotta run. Thanks for the help — and all your work on the tool! thanks3

mauricio.szabo23:02:24

Thank you too, for reproducing this error! 🙂