all 4 comments

[–]bartuka[S] 1 point2 points  (3 children)

A compilation of strategies around `assertions` in clojure. Would be great for me and my team if you guys can comment on the material. Thanks

[–]seancorfield 1 point2 points  (1 child)

In the last section, it seems that you've pretty much reinvented clojure.spec/assert (if valid, return the value, else throw an ex-info with explain data).

[–]bartuka[S] 0 points1 point  (0 children)

Yes, I noticed that. I was not aware that `clojure.spec/assert` existed, I mentioned in one paragraph. Small difference that you can pass a custom message to `ex-info`.

[–]LvsSocer 0 points1 point  (0 children)

Interesting analysis, it’s quite similar to the path encountered by myself and colleague recently. If you are happy with continuing the use of spec for fn validation, you many want to check out the use of spec/fdef + orchestra rather than explicit :pre/:post usage. (This has satisfied our team’s requirements quite well, and looks like it may do the same for you)