4 ms·
Checkout Clojure spec for a very expressive way of defining data requirements. It allows you to use arbitrary functions to describe data requirements. That way
by raspasov 5y ago
Checkout Clojure spec for a very expressive way of defining data requirements. It allows you to use arbitrary functions to describe data requirements. That way you are not limited by static, compile-time only descriptions of data flowing through your program.
- ragnese 5y agoI used Clojure on a project while spec was still alpha/beta or something, so I never used it. It does sound interesting, but I'm skeptical. Even the way you described it- I'm still just writing a function to validate my data, aren't I? Is that truly any different than just calling `validateFoo()` at the top of my functions in any other language?
- eckesicle 5y ago'Maybe Not' is a great talk on this subject matter. https://m.youtube https://m.youtube .com/watch?v=YR5WdGrpoug
- scns 5y agohttps://m.youtube.com/watch?v=YR5WdGrpoug https://m.youtube.com/watch?v=YR5WdGrpoug
- raspasov 5y agoThere's more power than that in spec. For example, you can globally define :address/zip to be a string that's more than, say, N characters long. Now anytime you encounter an :address/zip, regardless of whether it is inside, say :billing-address or :shipping-address dictionary/map, it can be checked for those function predicates.