Fork me on GitHub

Let me post my twitter question here as well 🙂 > Clojure library writers, what's your position on spec asserts? Leave it to library consumers to set, leaving it to calling code to> choose whether to assert or not, or enforcing it from the library to ensure malformed payloads always throw?


do you mean using spec.alpha/assert ?


probably wouldn’t use that in a library, I’d rely on instrument during dev/test. if you’ve got data coming in that must be validated (say user input or stuff coming in over a network) then you do an unconditional (when-not (s/valid ..) (throw …))


note that assert can be turned off by changing *compile-asserts*


and you wouldn’t want that for stuf that must be checked.