dirac 2017-03-01

fwiw, I had a file "out" lying around. Hence, directory could not be created. All fine now. Yay!

๐Ÿ˜ต 1

@qqq has joined the channel

@darwin: I have an on topic dirac question for once

the dirac browser repl running inside the chrome devtools

is there a way for emacs to somehow connect to it?

in other words, does dirac expose a nrepl?

nrepl has server and client(s), dirac implements nrepl client in chrome devtools

I'm looking at (dirac! :help)

how do I get the nrepl port number to connect to?

but it is more complicated, because nrepl talks over TCP/IP and devtools has only web sockets, that is why we have dirac agent which does a proxy/tunnel between those two

"how do I get the nrepl port number to connect to?โ€ who is asking and where?

in general you created nrepl server and configured dirac to use it

so you should know its port

is my "nrepl server" started by 1) build.boot line (dirac :ids #{"main"}) or 2) when I fire up chrome canary ?

I donโ€™t use boot, but it should be responsible for launching your nrepl server, at least my leiningen does

let me ponder more on this

also note that dirac has nrepl middleware which is a kinda nrepl server plugin, that has to be configured near that place

clearly I'm misunderstanding something, as truth = dirac devtools = nrepl client my previous thought: dirac devtools was a Nrepl SERVER that the web browser gui somehow connected to

also note that devtools is a web app, it cannot simply launch a server process on your machine

dirac devtools === nrepl-like client

I thought installing latest canary + running it with that long command ilne gave it special powers

thanks for pointing out mental errors

so if dirac devtools = nrepl like client

then it's 100% hopeless for me to go from emacs to send command to "dirac webtools ui" to ahve it 1) appear in the browser console and 2) execute in the browser console right? so even if I connected to the nrepl, it'd be two diffeerent client sessions

the ascii art in that readme is amazing

the diagrams are amazing; I'm going to underad that first, then I'll bother you at a later day

what you are trying to achieve is 100% possible, note that we have our code in nREPL server, in nREPL client (agent) and in devtools UI and all parts can communicate with each other

you are 95% there if you could reuse the same building blocks

I believe there is a chance it would work out-the-box with emacs, just nobody tried it before

Those diagrams are amazing. I think I get it now.

nrepl Server is at localhost::8230 dirac agent is at localhost::8231

and weasel connections are at localhost:8232 and up

so what I'm confused at is as follows -- do I just cider jack in 8230 ?

sorry, I donโ€™t use cider

my confusion being I had to rip out all my other middleware in order to install dirac

besides using cursive, is there any other way for me to test connecting another repl and sending cmds over?

easily, leiningen and boot support running nrepl clients from command-line

at least leiningen for sure

I can run "boot repl -c" fine, but when I run (start-repl), I get all types of weird stack traces if all goes right, I should be able ot connect to a browser repl, and not just a clj repl right?

why do you run start-repl?

dirac has nothing to do with start-repl which tries to do the same job but differently

https://github.com/adzerk-oss/boot-cljs-repl <-- standard way I used to get browser repls

let me figure out what I am doing wrong

when you connect to an nrepl server, you get a session, at that session is normal clojure

how do I go from "normal clojure" to "browser repl" ?

I can get normal clojure repl

again, I cannot help you with boot stuff, not sure what boot-cljs-repl is trying to do

but I assume it is trying to do their own weasel/browser-repl stuff

which has absolutely nothing to do with dirac

and you cannot expect it to work with dirac

this is fasicnating

type (dirac! :status) and then (dirac! :ls) and post it here

in your clojure repl which you entered via boot repl -c

this repl connection should have access to dirac commands, because your nrepl server should have dirac middleware installed in it

amazing, did not know this repl had dirac! on it

I'm going ot try (dirac! :join)

right! that should be your next step

this is your โ€œreplacementโ€ for (start-repl)

but the alert hello does not appear

see the last paragraphs

console output is a side-effect not a REPL command result

(+ 1 2) should work as expected

(+ 1 2) ==> 3 did work, both in my terminal & in the browser devtool

now try to connect to the same nrepl server from your emacs using normal nrepl client

not sure if it is called cider, but I think cider is much more than just an nrepl client implemented inside emacs

this is insane; I'm still in awe

if you want fullblown cider and dirac working together, cider will have to use another nrepl server, because cider and dirac middleware donโ€™t like each other

there is one weird bug:

cljs.user=>
at this place, if I type in (+ 2 3) we're good, if I just hit <enter> then my terminal freezes and I can't enter antything more at the terminal; not sure if this is a boot problem or what (perhaps it's sending NIL as input, and then waiting forever for something to print)

try it in lein repl :connect 8230

I suspect it is with powerlaces.boot-cljs-devtools

is that your package or someone else's ?

feel free to file a bug, I will look into that

thanks again for all your time

While we are at it ... dirac middleware "complains" when it detects other middleware - i.e. cider. Is that serious or more like "there is something else - you may get away with it"?

in my experience, it's "choose me or choose cider"

and in my experience, it's worth giing up cider for

the debugging suppot for stack frames / printing locals is amazing

Ok, so I guess if one really needs other middleware, you should just spin up another nrepl service on another port.

the 'joined dirac session' is amazing

which unfortunately, probably doesn't like other middleware either

@deas it was explained here: https://github.com/binaryage/dirac/releases/tag/v1.1.4, if you donโ€™t want to see that warning, I could add a config flag to disable it (in the next version)

@darwin A flag to disable it might be nice. In fact, I was wondering what to expect - especially wrt "popular" middleware like cider or clj-refactor.

I could also make this configurable: https://github.com/binaryage/dirac/blob/master/src/lib/dirac/lib/nrepl_tunnel.clj#L97 (this is how I detect expceted middleware, I ask for all supported operations, ciders adds bunch of new ones)

@darwin I think the solution should depend on what is to be expected. If 99% of the people see issues with cider, it may be best to simply spin up another nrepl service on another port.

@darwin: is there a debug option to tell dirac agent / nrepl server to be very very verbose? I want to see all msgs that are flying back and forth to see why it's hanging

Speaking of debugging: dirac.logging does not ship with the default jar. Might make sense to add it.

@darwin Doh! I hate being pointed to the faq. ๐Ÿ™‚

๐Ÿ™‚ np, there is a wall of text

@darwin: reporting that emacs / dirac repl works nicely with the following: 1. run inf-lisp process, with "boot repl -c" "(dirac! :join)" 2. define this function

(defun my-send-last ()
  (interactive)
  (comint-send-string
    (inferior-lisp-proc)
    (format "%s\r" (elisp--preceding-sexp))))
3. enjoy!

๐Ÿ‘ 1

@qqq nice! Iโ€™m glad to hear

@darwin: so I still haven't figured out the "(dirac :join) hangs if I hit enter twice in a repl" -- but if I only use the above, it (1) reads a sexp, and (2) sends precisely one \r, making it not hang

this info will be lost on slack, willing to update https://github.com/binaryage/dirac/blob/master/docs/integration.md? I would accept a PR with emacs-tips

@qqq I can confirm hang when hitting enter in nrepl client prompt, also dirac commands without parens are broken

I was reading about "debugging dirac" and it basically said "dirac is :optimizations :advanced; impossible to debug unless you ahve custom build"

@darwin: does this mean a 1.1.7 later today? ๐Ÿ™‚

probably not, Iโ€™m going to release a next one on sunday as usual

this is not urgent, I think

fair enough; if I may ask, do you get paid to dev dirac, or is this all just personal project ?

sunday sounds more than fair ๐Ÿ™‚

sank too many hours into it, but it was fun ๐Ÿ™‚

you should put :skip-paranoid-middleware-setup-check true into dirac agent options

a map with config options overrides can be passed into boot! as a parameter: https://github.com/binaryage/dirac-sample/blob/master/project.clj#L147 or you can use env var to override config: https://github.com/binaryage/dirac/blob/master/src/agent/dirac/agent/config.clj export DIRAC_AGENT__SKIP_PARANOID_MIDDLEWARE_SETUP_CHECK=true should work

๐Ÿ‘ 1