Hello, First of all, I'm also very interested in increasing support for contract programming in clojure. In my mind, it's perfectly complements dynamic nature of clojure by providing that type of in-code documentation which people coming from statically-typed language often feel lack of. So, I want to thank you for writing such necessary lib!
Actually, your example was so inspiring that I wrote my own contract programming library :) You can see the source code here: https://github.com/dnaumov/clojure-contracts Probably the main differences between the two is that Trammel operates on expressions, while clojure-contracts works only with functions (e.g. (not= 0 x) from the example on Trammel's main page becomes (not= 0), or, without syntax sugar, (partial not= 0)). I believe it allows contracts to be more composable and reduce the need for explicitly declaring the argument list. Another notable difference is emphasis on error reporting - actually the main goal for me is to get rid of those stacktraces and NullPointerExceptions, and replace them with user-friendly error messsages. This project is a work in progress, and only a small subset of planned features is implemented yet. Namely, the following (should) work right now: - basic contracts with or without explicit args declaration (=> [number? number] number?) - dependent contracts, checking arbitrary expressions (=> [x y] {x number?, y number?, (+ x y) pos?} (partial < (* x y)) - contracts for higher-order functions (=> number? (=> number? number?)) - contracts for multi-arity and variadic functions (=> ([k v] [k v & kvs]) ({k pos?, v pos?} {k pos?, v pos?, kvs (comp even? count)}) map?) You can see more such examples in the tests<https://github.com/dnaumov/clojure-contracts/blob/master/test/contracts/test/core.clj> . Also, there is a bunch of predicates and other helper functions in this namespace<https://github.com/dnaumov/clojure-contracts/blob/master/src/contracts/preds.clj> . As you can see, there is no docs at all yet, and I haven't done public annonce. That's because I'm not sure about the future of this project; do we really need 2 non-compatible libs with exactly the same purpose? Wouldn't it be better to concentrate efforts on a single library and promote its use, so the clojure could finally got something better than creepy stacktraces? (well, another thing is that trying to compete with such a famous and cool person as you are is a stupid idea :)) Um, it turned out rather long. Anyway, the conclusion is that I really need community and especially your feedback on it. Thanks for reading! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
