clojure-spec 2022-08-22

is there a reason that there's no concrete Spec type/class? I have a desire to extend a library I'm writing to dispatch on whether a value is a reified spec value, and I can't easily do that without taking a dependency directly on clojure.spec.alpha

i.e. the only way I can tell whether I've been passed a spec is by using s/spec?

Alex Miller (Clojure team) 2022-08-22T18:04:34.566869Z

It's not a type

Alex Miller (Clojure team) 2022-08-22T18:13:34.477419Z

You could dynamically load and resolve that function

that doesn't work in CLJS

in various places in clojure.spec.alpha an object is created via (reify Spec ,,,) and returned, which is what I want to extend the behavior of

I don't care about the name, just wishing there was a concrete type I could extend

Alex Miller (Clojure team) 2022-08-22T18:49:44.026019Z

sets are also specs, and functions. there is not "one type" to check for

Alex Miller (Clojure team) 2022-08-22T18:53:58.255899Z

the behavior is defined via the protocol. things like with-gen are a good example of extending by wrapping. but maybe there is some better way to do what you need, not sure