Fork me on GitHub
#chlorine-clover
<
2020-02-25
>
mauricio.szabo01:02:45

Oh, well....... it seems the problem is harder than I thought. When Chlorine connects to a socket, it sends the UNREPL string to upgrade the REPL. This binds *out* to unrepl.core/write When any command (like load-file) runs, if it uses *test-out* (because, for some reason, it is different from *out* and so it is not sent over the socket) Chlorine will try to bind it to *out* (so we'll see the results in Atom).

mauricio.szabo01:02:17

Then things get weird: this *out* does not exist on other REPL connections.... so it raises the error. Even if I try to bind *test-out* locally, load-file will make it leak for the outside world (because it uses def, that changes environments globally, for all threads)

sparkofreason16:02:22

Here's the solution I came up with for using #reveal with #chlorine (hat tip to @seancorfield for getting me unstuck): Add this alias:

:reveal {:extra-deps {vlaaad/reveal {:mvn/version "0.1.0-ea4"}}
           :extra-paths ["/Users/dave.dixon/.clojure"]
           :jvm-opts ["-Dclojure.server.repl={:port,50505,:accept,my.repl/start}"]}
pointing to your .clojure folder (or wherever you want to run startup scripts). In that folder add this clj file in the appropriate hierarchy:
(ns my.repl
  (:require [vlaaad.reveal.ui :as ui]))

(def reveal (ui/make))

(defn start
  []
  (clojure.core.server/repl))
Then modify the wrap_in_rebl_submit from @seancorfield's init.coffee as:
wrap_in_rebl_submit = (code) ->
  "(let [value " + code + "] " +
  "  (try" +
  "    ((requiring-resolve 'cognitect.rebl/submit) '" + code + " value)" +
  "    (catch Throwable _))" +
  "  (try" +
  "    ((requiring-resolve 'my.repl/reveal) value)" +
  "    (catch Throwable _))" +
  "  value)" 

vlaaad21:02:17

@mauricio.szabo I added normal repl to Reveal (in addition to prepls) and tried it with Chlorine, you might be interested: https://github.com/vlaaad/reveal/issues/2#issuecomment-591068889

vlaaad21:02:26

I'm not sure if Chlorine and Reveal can easily compose, Chlorine seems to need structured output provided by unrepl, and Reveal is supposed to be used as a repl directly...

sparkofreason16:02:45

So far I haven't seen any issues...so far.

vlaaad16:02:33

I’m glad that you gave it a try! By the way, you can try doing this on repl start:

(add-tap (ui/make))
While the JVM remains running, there will be a window with tap> results

vlaaad16:02:09

I’d be happy if you shared your thoughts about using Reveal

sparkofreason18:02:34

I'll post them to #reveal as I get some more time with it.

seancorfield21:02:10

So (ui/make) returns a function that can be invoked on values @vlaaad? That's an interesting model...

vlaaad21:02:08

ASAP (as simple as possible)

4
mauricio.szabo21:02:09

Great, I'll look at is ASAP (as soon as possible 😆) On a side note, just published 0.4.12, which will (hopefully!) fix the @aviflax's bug, and also probably fix the errors on unrepl.core/write being unbound 🙂

🤯 4
👏 4
🎉 4
💪 4
seancorfield21:02:37

@mauricio.szabo Is there any way to control how tall (or wide) the console/repl pane is when it opens?

4
seancorfield21:02:14

By default it opens half height (or half width) and it would be nice (for me, at least 🙂 ) to be able to specify a smaller height (or width).

seancorfield21:02:56

(what made me think of that is that the linter UI package lets you set a maximum height as a config option)

mauricio.szabo22:02:29

There's no such option for now, but I also am thinking on adding it. Will check the Atom API and see how to control it

8
👍 4