Fork me on GitHub
#clojure-spec
<
2018-04-18
>
Garrett Hopper02:04:34

Is it possible for me to have a spec: s/cat regex where latter parts of the regex use predicates that depend on the conform of prior parts?

Garrett Hopper02:04:29

I guess the alternative would be to have a second spec to run after the first one, so it can depend on the output of the first one.

cap10morgan16:04:03

If you had some spec'd code where correctness was far more important than performance, a) would it make sense to turn on instrumentation of every fn at production runtime and b) if so, how would one go about doing that?

seancorfield17:04:41

@cap10morgan instrument accepts a sequence of symbols to instrument as I recall. You'd probably want to just instrument the functions in specific namespaces (your own) to avoid turning on instrumentation for all libraries functions in your app.

seancorfield17:04:42

(you can "instrument everything" by calling instrument with no arguments but you wouldn't know what functions got instrumented so you'd have no idea about performance impact)

Alex Miller (Clojure team)17:04:16

you would know as it returns a collection of all symbols instrumented

seancorfield17:04:41

I meant, ahead of time.

Alex Miller (Clojure team)17:04:50

you do have to ensure the specs have been loaded (by requiring them) before calling instrument

seancorfield17:04:26

But, yeah, you could potentially get a very long list of instrumented functions that you weren't expecting 🙂