Fork me on GitHub
#clojure-spec
<
2018-07-14
>
roklenarcic21:07:46

Hm I thought this would work:

(alter-var-root #'s/*explain-out* (constantly exp/printer))

bbrinck09:07:35

Is this at the REPL? If so, you’ll want to use ‘set!’ not ‘later-car-root’

bbrinck09:07:14

Sorry, autocorrect on my phone makes talking about code difficult 😀

bbrinck09:07:54

Here’s a gist that shows why alter-var-root doesn’t work as you might expect in this context https://gist.github.com/bhb/d82fcf0f80f555c28afa8db320be16c8

bbrinck09:07:41

And here’s a different gist with an example of how I’d recommend setting up expound for instrumentation (if that’s what you are looking to do) https://gist.github.com/bhb/649c46ac6dfa290fa6a62bb96fb66f62

bbrinck09:07:07

@U66G3SGP5 Let me know if you encounter any problems with the above code

roklenarcic11:07:28

I tried set! before, but it's been my understanding that it only sets var value for current thread

bbrinck11:07:24

Hm, I’m not sure what happens in threads started within the REPL - I can check later. You might have to call ‘set!’ in each thread. But in any case, alter-var-root! won’t work in the REPL context since the var is bound by Clojure before your code is run, so I think ‘set!’ is the only solution.

athos06:07:47

A quick workaround for this is to try (alter-var-root #'s/*explain-out* (constantly exp/printer)) in your user.clj. Clojure runtime should automatically load user.clj (if it exists) before launching the REPL.

bbrinck13:07:27

@U66G3SGP5 Are the threads being created within the REPL context? If so, it looks like set! will apply. See this gist. https://gist.github.com/bhb/910f718e2da57793bc0f5817f006f28a

bbrinck13:07:27

If threads are being created outside the REPL, then yes, I would try what @U0508956F suggested above.

bbrinck13:07:26

@U7PBP4UVA Did you end up getting expound to work with multiple threads?

roklenarcic21:07:03

to make all my stuff print spec errors with expound