Fork me on GitHub
#cursive
<
2017-11-21
>
danm09:11:25

@cfleming I hadn't tried generating them yet. My understanding (which may be incorrect) was that the message occurred when you were calling functions in namespaces that Cursive didn't 'know' about, and therefore assume you needed stub functions generating to fill in later. In my case the lib is downloaded and working when I compile the code, so I thought asking Cursive to generate the stubs would be the wrong thing to do, because it should be able to find the lib already

cfleming10:11:23

@carr0t No, that’s incorrect. Here’s what this does.

cfleming10:11:43

(I actually need to document this correctly, so I’ll try to explain here then use this as the basis for the doc)

cfleming10:11:10

Cursive works using static analysis, not runtime introspection like most other Clojure tools do. However not all libs are amenable to this. The most obvious example is Datomic, which is closed source so Cursive can’t analyse it at all.

cfleming10:11:00

But a lot of other libraries generate vars using various sorts of tricks - some are just a pain to analyse, and some (e.g. Midje, Overtone) use macros so heavily that analysing them is basically impossible.

danm10:11:21

Aah yes, I had noticed it had issues with macros

cfleming10:11:15

For these sorts of libraries, runtime introspection works better, so what Cursive will do is start a process with the runtime of the module, load the namespaces that it can’t analyse correctly and then introspect it to generate “stub” source files which it can analyse.

cfleming10:11:40

That only has to be done once, then those files can be used from then on (or until e.g. the library version is upgraded).

cfleming10:11:27

It’s not a perfect solution, and more complete macro support is coming, but it helps a lot with some important libs, particularly Datomic.

cfleming10:11:56

So hopefully, you should just be able to tell Cursive to generate the stubs, and it will stop bothering you.

cfleming10:11:26

Currently the list of namespaces to do this for is hard-coded, but it will be configurable at some point.

cfleming10:11:45

@carr0t Does that help?

danm10:11:20

It does, thank you. (Sorry, we had standup)

danm10:11:45

Where are you based, btw? I'm in the UK, so it's coming up to 11am here. I assumed you were US based, but had no evidence for that

cfleming10:11:29

No worries - I’m in New Zealand, so it’s way past my bedtime 🙂