dirac

Dirac v1.7.2 is out: https://github.com/binaryage/dirac/releases/tag/v1.7.2
adamrenklint 2018-01-27T19:59:27.000027Z

Just discovered Dirac, wow, am blown away. But I have an issue where I can see all the refers and aliases of the current namespace in the autocomplete menu, but when I try to access or use them, I get back undefined. Using the fully qualified symbols works just fine. Any guidance on how I can resolve this?

2018-01-27T20:00:56.000072Z

hi, this will be tricky diagnose over slack, it would be great if you could isolate it to minimal case and share your project

2018-01-27T20:01:03.000052Z

I would look into it

2018-01-27T20:02:01.000031Z

btw. do you use figwheel or some hot-reloading? autocompletion goes out-of-sync for hot-reloaded code

adamrenklint 2018-01-27T20:02:26.000005Z

Yeah, I have boot-figreload as well

2018-01-27T20:02:56.000118Z

just make sure that you are seeing the problem after first full load without any hot-reloading

adamrenklint 2018-01-27T20:03:13.000053Z

Yeah, that's the case

adamrenklint 2018-01-27T20:03:26.000050Z

Will create a minimal repro :thumbsup:

2018-01-27T20:03:59.000068Z

FYI, this is the function which is used to “understand” aliases: https://github.com/binaryage/dirac/blob/master/src/implant/dirac/implant/analyzer.cljs#L32

2018-01-27T20:04:17.000008Z

it uses clojure.tools.namespace.parse

2018-01-27T20:43:57.000019Z

@adamrenklint wait, maybe you are not in proper namespace? did you use in-ns to switch? please follow https://github.com/binaryage/dirac-sample#hello-world

adamrenklint 2018-01-27T20:56:42.000102Z

Yeah, definitely did that. A minimal repro comes in ~10 minutes, just finishing up the instructions.

adamrenklint 2018-01-27T21:00:44.000051Z

@darwin here it is: https://github.com/adamrenklint/dirac-repro

2018-01-27T21:03:51.000139Z

thanks, going look into that right now

2018-01-27T21:12:57.000039Z

@adamrenklint having some problem running boot dev on my machine, clojure.lang.ExceptionInfo: Call to clojure.core/defn- did not conform to spec:

2018-01-27T21:13:02.000084Z

what is your boot version?

2018-01-27T21:13:18.000007Z

@darwin uploaded a file: https://clojurians.slack.com/files/U08E3BBST/F8ZNGQDM0/-.clj

adamrenklint 2018-01-27T21:16:17.000092Z

Same as you 😕

2018-01-27T21:16:24.000112Z

it looks like something is wrong with generate-lein-project-file! in boot

2018-01-27T21:16:55.000075Z

I noticed my clojure updated recently (via homebrew), maybe they have some more strict specs included

adamrenklint 2018-01-27T21:17:34.000071Z

Ok, let me install Clojure via Brew and see if I get the same error

2018-01-27T21:17:54.000083Z

ok, mine is at 1.9.0.315

2018-01-27T21:18:01.000001Z

brew info clojure

2018-01-27T21:20:52.000040Z

hm, I switched brew to 1.9.0.297 and still the same issue, so that is probably not the case

adamrenklint 2018-01-27T21:22:32.000006Z

Yeah, I have 1.9.0.315 via brew now, and boot dev is still working

adamrenklint 2018-01-27T21:22:47.000041Z

Need to lookup what this generate-lein-project-file! is, never heard of it before

2018-01-27T21:23:33.000123Z

here is the full error: https://gist.github.com/darwin/338e5eec68cf1ed0e7c516a45830fd7c

2018-01-27T21:23:42.000072Z

I will try to disable spec checks for now

2018-01-27T21:26:11.000100Z

I should be able to disable it via clojure.spec.skip-macros, but setting it as env variable does not work for me

2018-01-27T21:27:13.000051Z

btw. no boot commands work, all throwing

2018-01-27T21:27:26.000057Z

I’m going to install it differently

2018-01-27T21:27:28.000085Z

not via brew

adamrenklint 2018-01-27T21:27:29.000007Z

Hmm, weird

2018-01-27T21:29:07.000132Z

hm, no, even their one-liner installer script is broken for me

adamrenklint 2018-01-27T21:30:34.000069Z

:poop:

2018-01-27T21:30:53.000002Z

this is definitely something about my machine, investigating

adamrenklint 2018-01-27T21:31:03.000023Z

The only reference to the issue I find is here: https://clojurians-log.clojureverse.org/boot/2017-03-03.html

adamrenklint 2018-01-27T21:31:14.000095Z

But yeah, sounds like your machine has other issues

2018-01-27T21:31:59.000072Z

the problem is how to force that fancy boot trace to show full paths

2018-01-27T21:32:14.000107Z

maybe I have some obsolete boot version lingering somewhere and it is using it

2018-01-27T21:32:53.000031Z

looking for a way how to disable it or at least change it to full paths

2018-01-27T21:33:54.000052Z

the problem is that generate-lein-project-file! does not conform to fn or macro specs, so it looks like old code or I have too recent specs or my specs are somehow confused

2018-01-27T21:34:04.000091Z

maybe by installing some dev version of clojure or something like that

adamrenklint 2018-01-27T21:35:00.000051Z

It's weird, because the project I sent you has a boot.properties file, so the Clojure and Boot version used should come from there

adamrenklint 2018-01-27T21:35:29.000008Z

Of course, the Boot loaded (a Go app, I think) is the one installed with Brew or by other means

adamrenklint 2018-01-27T21:35:50.000096Z

Try deleting ~/.boot 😸

adamrenklint 2018-01-27T21:36:09.000020Z

That's what I do when things get messy

adamrenklint 2018-01-27T21:37:07.000040Z

Oh BTW, I have JDK9. Not sure how that would make a difference in any way, but mentioning it anyway

2018-01-27T21:38:51.000035Z

ok, removing ~/.boot fixed it

2018-01-27T21:39:02.000118Z

there was something fishy there I guess

adamrenklint 2018-01-27T21:39:10.000058Z

:thumbsup:

2018-01-27T21:40:01.000081Z

I’m not familiar with boot, didn’t start using it, but I agree it is a better way than lein

2018-01-27T21:42:13.000031Z

ok, I confirm that your steps are reproducible here with my dev build of dirac

2018-01-27T21:42:20.000015Z

so I will be able to investigate

adamrenklint 2018-01-27T21:42:24.000108Z

Ok cool, so I'm not crazy 😛

2018-01-27T22:00:45.000010Z

@adamrenklint I think the issue is in your REPL, normally you should do (require 'dirac-repro.core) before you in-ns into it

2018-01-27T22:01:15.000071Z

this way REPL would be generating code aware of all definitions in the namespace

2018-01-27T22:01:26.000072Z

but for some reason it does not work with your repl

2018-01-27T22:02:04.000017Z

I’m not sure what boot is doing there, but we should be able to run stanalone clojurescript repl driven by boot and test it there

2018-01-27T22:02:38.000012Z

btw. the code generated by the REPL can be seen in devtools unders Sources/left tree/dirac-repl

2018-01-27T22:04:56.000140Z

it looks like require in your REPL is broken and it does not read the file

2018-01-27T22:05:00.000070Z

on repl side

2018-01-27T22:05:42.000097Z

(require 'dirac-repro.core) followed by (in-ns 'dirac-repro.core) and then as-aliased generates dirac_repro.core.as_aliased javascript

2018-01-27T22:07:36.000067Z

it should generate dirac_repro.as_aliased javascript

adamrenklint 2018-01-27T22:08:32.000106Z

When you say your repl, which piece are you referring to?

adamrenklint 2018-01-27T22:09:06.000108Z

org.clojure/tools.nrepl?

adamrenklint 2018-01-27T22:09:31.000064Z

Sorry, a complete noob when it comes to REPLs, so not much experience to draw from

adamrenklint 2018-01-27T22:09:42.000046Z

A child of save->reload trying to evolve 🙂

2018-01-27T22:10:19.000021Z

I’m not sure here, because whole REPL situation is pretty huge mess, right now I have unloaded whole context out of my head

2018-01-27T22:10:54.000084Z

I wrote this piece, when I had it in my head 😉 https://github.com/binaryage/dirac/blob/master/docs/about-repls.md

2018-01-27T22:12:29.000007Z

I’m now goint to try the same thing in dirac-sample project, which is driven by lein’s repl machinery, and compare the behaviour

2018-01-27T22:32:59.000078Z

@adamrenklint ok, now I understand

2018-01-27T22:33:19.000043Z

the system works as expected, your only mistake was not using require

2018-01-27T22:34:46.000067Z

using namespace alias alone does not refer to the namespace javascript object, e.g. reagent or as-aliased alone is not treated as something meaningful

2018-01-27T22:35:00.000028Z

as-aliased/some-func will work

adamrenklint 2018-01-27T22:35:22.000078Z

Ah ok

adamrenklint 2018-01-27T22:35:53.000038Z

Thanks for digging into it, much appreciated!

2018-01-27T22:36:20.000025Z

I got confused by that namespace-only thing, I would also expect it to work

adamrenklint 2018-01-27T22:36:27.000037Z

I'll boot up my large project and try it there

2018-01-27T22:37:57.000064Z

btw. figwheel’s repl is able to do those requires automagically for you, because figwheel knows about your cljs project (for hotloading) and is loading them anyways

2018-01-27T22:38:26.000050Z

but it is not easy to force dirac to use figwheel’s repl, that is very advanced setup

adamrenklint 2018-01-27T22:39:05.000109Z

Ok, will read through that and play a bit 🙂

adamrenklint 2018-01-27T22:42:13.000025Z

Is there a reference implementation of that setup somewhere?

2018-01-27T22:44:30.000016Z

it starts vanilla clojure REPL, inside it starts figwheel’s sidecar and Dirac Agent

2018-01-27T22:44:49.000049Z

Dirac should be able to detect this situation and talk to figwheel’s repl

adamrenklint 2018-01-27T22:46:03.000046Z

Ok interesting, I'll give that a try tomorrow

adamrenklint 2018-01-27T22:46:13.000009Z

Thanks a bunch for taking the time to help me!

🍻 1
2018-01-27T22:50:29.000005Z

I just tested it and it works here, running lein repl-figwheel instead of lein repl

2018-01-27T22:50:41.000057Z

then in dirac prompt dirac :fig shows fighweel status

2018-01-27T22:50:55.000061Z

dirac :ls shows all compiler sessions on server side

2018-01-27T22:51:07.000113Z

dirac :switch 2 switches to figwheel session in my case

2018-01-27T22:51:38.000033Z

from that point repl is aware of hot-reloaded code and requires are no longer needed

2018-01-27T22:52:19.000078Z

unfortunately dirac command in dirac prompt has broken formatting, some CSS went wrong, will fix this eventually