Re: clojure.spec s/keys map key with alternative definitions in same namespace

2017-02-07 Thread Dave Tenny
>From my perspective, there are two specs. I'm not trying to mash them together, however I would like to use the appropriate spec with the same keyword in maps, in different contexts. It wouldn't be an issue if the contexts were in separate namespaces. It's only an issue because the two specs ar

Re: clojure.spec s/keys map key with alternative definitions in same namespace

2017-02-07 Thread Alex Miller
Spec names are intended to have enduring global semantics. So the notion of the same spec name having different semantics at different times seems to be at odds with that. In general, it's often helpful to think about all the possible values that an attribute will have - that's the true spec. I

clojure.spec s/keys map key with alternative definitions in same namespace

2017-02-07 Thread Dave Tenny
Let's say I have these definitions for a "job" record I'm managing, perhaps in a database. (s/def ::job-status #{:in-progress :completed}) (s/def ::user-id (s/and integer? #(>= % 0))) (s/def ::job-id integer?) (s/def ::coercible-job-type (s/and named? #(not (empty? (name %) (s/def ::job-type