Fork me on GitHub
#tools-deps
<
2018-05-20
>
raymcdermott13:05:44

I’m trying to make use of add-lib using clojure 1.10-alpha4 with the prepl …

raymcdermott13:05:06

@alexmiller is that combo possible?

dominicm13:05:21

@raymcdermott what happened when you tried?

raymcdermott13:05:19

:cause “Context classloader is not a DynamicClassLoader”

raymcdermott13:05:19

bit weird though cos it partly works

raymcdermott13:05:33

so it ‘works’ when evaluating something that is in the path … but that’s not so useful 😉

raymcdermott13:05:18

but I’m stabbing and poking around, so asking here to get a steer on whether it’s meant to be viable

dominicm13:05:34

@raymcdermott My suspicion is that however the socket repl starts, doesn't cause a DynamicClassLoader to be run, I think you can insert one, but can't remember from the top of my head how that's done.

Alex Miller (Clojure team)13:05:12

That would be a good guess but I haven’t tried it

dominicm13:05:14

@raymcdermott How are you running that clj file?

dominicm13:05:18

I think that uses aot-ish stuff, but I'm not certain.

raymcdermott13:05:38

I’ll run it with clj and see if it makes any difference

mfikes13:05:25

@raymcdermott when I hacked add-lib into ClojureScript, the hack needed to deal with the same issue: https://github.com/mfikes/clojurescript/commit/d68c9397599366777d9b322ec586fdd398302f25

mfikes13:05:16

See that bit where it forced the issue so that the classloader is a clojure.lang.DynamicClassLoader. This might not be the "correct" solution, but it worked.

raymcdermott13:05:37

nice - I’ll check it out

mfikes14:05:28

If you end up needing to run that code for any reason to suss out what it is doing, https://gist.github.com/mfikes/a81ae3d006830dc34663f976aaf2291b

Alex Miller (Clojure team)14:05:57

Setting the context classloader to a DCL should work

Alex Miller (Clojure team)14:05:28

Although that is a per-thread solution

raymcdermott14:05:08

ok, so it’s the same whether I run it via CLJ or not … just thought I would check that out first

raymcdermott14:05:39

DCL next - one thread is fine for now ( who needs more! 😉 )

mfikes14:05:12

I'd cram it in early @raymcdermott (in a main if you can like in that ClojureScript hack), so any threads thereafter inherit it. "When a Thread is created, it’s context classloader is set from the parent Thread." http://puredanger.github.io/tech.puredanger.com/2007/06/15/classloaders/

Alex Miller (Clojure team)16:05:03

wow, old school reference :)

raymcdermott14:05:12

with DCL all works

raymcdermott14:05:52

good call @mfikes, will do - had it in the REPL code but will move it further out

raymcdermott15:05:05

and - bonus - my code is now all set up with deps.edn and running with CLJ 😎

robert-stuttaford16:05:33

what’s the correct way to force a SNAPSHOT download with clj / tools.deps?

Alex Miller (Clojure team)17:05:43

There isn’t a way at the moment - I have a ticket for that. You can just delete the version from your .m2 though and use -Sforce