Fork me on GitHub
#clojure-spec
<
2018-11-11
>
didibus00:11:46

I don't get that behavior

didibus00:11:12

This works fine for example. Even though if you run:

(sgen/generate (s/gen `add))
you get ExceptionInfo Unable to construct gen at: [:a] for: (= (type %) java.lang.Long) clojure.core/ex-info (core.clj:4739)

Alex Miller (Clojure team)00:11:58

when an instrumented fdef with an fspec is checked, the :args spec of the fspec is generated and then the fspec function is invoked to verify it conforms to its spec

Alex Miller (Clojure team)00:11:17

many people find this surprising and I expect we will ultimately change it

schmee00:11:44

what do you think of my suggestion above as a temporary measure (to not call validate-fn when *fspec-iterations* is 0 or nil)?

schmee00:11:37

also, I appreciate that you are considering options for this 🙂

didibus00:11:39

Oh I see, you mean if you spec a higher order function on an fdef. Interesting, I don't think I ever specced one before.