Fork me on GitHub
#clojure-spec
<
2021-04-13
>
Michael Stokley01:04:21

are there ways to programmatically work with specs when the output of s/get-spec is an object, in some cases? are there ways folks approach this?

Michael Stokley01:04:41

i'm seeing that i can't build up expressions programmatically out of existing specs

Alex Miller (Clojure team)01:04:12

this is one of the big things addressed in spec 2 (via several different options) but it can be cumbersome to do in spec 1

Alex Miller (Clojure team)01:04:35

in spec 1, one approach is to use macros to emit spec forms

Alex Miller (Clojure team)01:04:57

the other option is to s/form a spec object (the result of s/get-spec) to get back to a form, then manipulate it as a collection, and either s/def or eval it

🤯 3
Michael Stokley01:04:49

wow, ok! thank you!