Fork me on GitHub
#clojure-spec
<
2017-07-28
>
bfabry17:07:21

@alexmiller is there anywhere to look to find out which core functions are spec'd / will be spec'd?

bfabry17:07:48

actually there's an obvious answer to that, just grep for fdef in master, doh

jpmonettas18:07:34

@bfabry check out https://github.com/jpmonettas/inspectable/ , specially the browse-spec functionality

noprompt20:07:45

does anyone know of existing code which produces fully resolved spec descriptions with respect to the namespace from whence they came?

noprompt20:07:57

e.g. (spec/describe some-spec) => (clojure.spec.alpha/coll-of foo.bar/bean-sprout?) not (`(coll-of bean-sprout?)`)

noprompt20:07:35

i’m asking before i embark on the journey.

jpmonettas20:07:24

if I understood correctly (spec/form some-spec) is what you are looking for

jpmonettas20:07:32

also check https://github.com/jpmonettas/pretty-spec if you want to pretty print it

wilkerlucio20:07:44

@noprompt I did some stuff that does reflection on the specs, I would be interesting to know if you can figure that out. afaik, this can be tricky, because to correctly resolve that you need to know the namespace definitions for the place where the spec was defined (which can be different from the spec namespace itself), so I'm not sure if that is even possible, given that you might not be able to disambiguate the non-qualified names (or even the qualified, considering aliases can change). but anyway, please let me know if you figure it slightly_smiling_face

jpmonettas20:07:32

@noprompt @wilkerlucio but isn't (spec/form ...) just that?

wilkerlucio20:07:04

@jpmonettas that returns the original form as data, but it doesn't give you the context about, so imagine that I have a spec like (s/def ::some-spec my-pred?), just by reading the form, how can you tell from where my-pred? comes from?

wilkerlucio20:07:18

maybe by getting the var from the function reference, might be possible there, but then I have no idea on how to do that on CLJS

jpmonettas20:07:02

@wilkerlucio sorry still don't get it, s/form returns everything qualified, I think the idea is you can serialize, deserialize specs

wilkerlucio20:07:25

@jpmonettas ha, you are right, hahha, man, I was assuming it didn't because of what noprompt said, but I did the test now and you are right, it returns with the full name 😅