Reputation: 4113
I have just recently started to learn some clojure
and in order to make something like types (more like contracts) for validations etc, the go-to solution is a library named schema
.
Recently I learned that clojure 1.9
however will have something similar named clojure.spec
Can anyone please tell me the differences between them?
When should I use one or the other, pros and cons, etc?
Upvotes: 9
Views: 519
Reputation: 732
Eric Normand did this comparison, but as already pointed out you should definitely check the rationale, and there is also the guide and a podcast where Rich Hickey talks abouts clojure.spec.
Upvotes: 4
Reputation: 10653
The spec rationale is quite in-depth, I would suggest reading it: https://clojure.org/about/spec after that feel free to compare it with any other library you may be considering.
Upvotes: 3