I'm new to Clojure and at first sight from what I see core.spec does everything that :pre & :post defn conditions is used for PLUS much more.
I understand that core.spec was introduced much later(and still in alpha/beta phase) and :pre & :post defn conditions existed for much longer - maybe that's the reason why pre/post are still not considered as obsolete approach?
Is there something that :pre/:post offers that I can't get from core.spec?
Thanks
Many people prefer Plumatic Schema to Clojure Spec (both have their strengths). clojure.test.check
is also very powerful.
The main point here is that all of the above only apply (normally) when running unit tests. The :pre
and :post
checks apply always when the function executes.
Another tool I like is the Plumatic Schema function validate
. You can find a similar (but better) function at tupelo.core/validate
.