Fork me on GitHub

Hi everybody. I’ve been learning spec lately, and I think I have a decent grasp of its mechanics. What I don’t fully grasp is the real life effective use of spec. When should we be using spec? Should I be speccing as many of my functions and as much of my data as I can? Or just the borders? Or just what is publicly accessible?

Alex Miller (Clojure team)03:03:29

there is no one right answer to that question

Alex Miller (Clojure team)03:03:44

I don’t think you should or need to instrument everything

Alex Miller (Clojure team)03:03:10

spec’ing at the borders is particularly helpful, but any function with sufficiently complex inputs or outputs is worth considering

Alex Miller (Clojure team)03:03:58

instrumentation is worth using at dev time, check is worth doing at test time, and validation is (maybe) worth doing at runtime


Thanks for the response. I’ll keep that in mind!


we’re considering putting some (s/assert ...) at the beginnings of some functions, which can be compiled away with the right system property