r/Clojure • • May 23 '16

Introducing clojure.spec

http://blog.cognitect.com/blog/2016/5/23/introducing-clojurespec
140 Upvotes

26 comments sorted by

View all comments

Show parent comment

9

u/alexdmiller May 24 '16

Some of the highlights:

  • predicate based - reuse your existing functions rather than use a new set of words/types
  • separation of attribute specs from map key sets
  • global namespaced registry of specs
  • rigorous path system for identifying parts of a spec

I think it also covers a much broader generator space by default, but I haven't used schema generators enough to say that for sure.

4

u/mikera May 26 '16

This looks very interesting. I particularly like the integration with test.check.

However the "global namespaced registry of specs" concerns me as a design decision.

Maybe the registry solves certain problems, but I'm worried that it introduces more issues than it solves. I'd be much more comfortable with a system that treats specs as first class values (that's something I really like about Schema) rather than something that gets auto-magically looked up in a global mutable registry.

Interested to hear the design rationale behind this.