Closed aew closed 7 years ago
I was thinking about using clojure-spec backport for supporting Clojure before 1.9. To make it clean, we might need consider not to use namespace clojure.future. So that for project using Clojure 1.9.0, the clojure-spec-backport can be excluded easily.
Assume only validator will use clojure.spec. A few options I am thinking:
For project using Clojure< 1.9.0, if validator is used, clojure-spec-backport is required, if validator is not used, clojure-spec-backport is not required.
For project using Clojure 1.9.0, clojure-spec-backport can be excluded.
For all projects, clojure-spec-backport might be conflict with clojure.spec in 1.9.0
I don't think such a backport belongs into libraries. Shouldn't it be something users with old Clojure versions include? E.g.:
:dependencies [[org.clojure/clojure "1.8.0"]
[graphql-clj "0.1.17" :exclusions [org.clojure/clojure]]
[clojure-spec-backport "1.9.0-alpha13"]]
Of course, the backport has to provide the namespace clojure.spec
then, to seamlessly integrate with e.g. graphql-clj.
I've updated this PR to reflect the comments. I replicated 3 functions from clojure.future in order to do this. To @xsc's point, library users can make this decision for themselves. I've added instructions to the readme for this.
I've seen a number of different libraries that do not yet work with Clojure 1.9, so it seems premature to force this on the library user today given the use of spec.
Also, refactor spec namespace to consistently put node before state, as in the visitors / validators.