Fork me on GitHub
#clojure-spec
<
2016-07-17
>
Alex Miller (Clojure team)01:07:42

Yes to some degree. I went through and wrote most of them at one point but things have drifted. However, we explicitly don't check macro fdefs in spec as that will cause an infinite loop.

Alex Miller (Clojure team)01:07:06

So they may exist mostly as documentation

gfredericks13:07:00

the uncheckable macro?

lvh21:07:18

Why is keys a macro?

gfredericks21:07:52

I expect the same reason most of the spec definers is a macro

lvh21:07:02

I don’t know what that reason is (I just know that it’s annoying when I’m dynamically defining specs and it’s complaining that (some expr) isn’t a bunch of namespaced keywords)

gfredericks21:07:07

"Yes, this means that more of the surface area of clojure.spec will be macros, but specs are overwhelmingly written by people and, when composed, manually so."

gfredericks21:07:37

why're you generating your specs

lvh21:07:42

I have some json schema, I’m trying to produce specs

gfredericks21:07:00

why not go the other direction?

lvh21:07:03

so, they’re macros because they want to see the exact expr being used?

lvh21:07:07

how do you mean?

lvh21:07:25

I see. I’m not going the other direction because I’m not writing the json schema

lvh21:07:46

it’s other people’s json schema, for other services; also json-schema for swagger, which I in turn use to generate specs for even more third party stuff

lvh21:07:03

unfortunately it’s unlikely that I get all of these vendors to port their swagger specs to clojure.spec 😄

gfredericks21:07:40

yes they want to see the exact expression

gfredericks21:07:14

so you probably have to think of it more as a pre-compile step

lvh21:07:26

as in, have the macro-hood leak through?

lvh21:07:40

that’s a good idea, right now I solved it with eval, but bleh

lvh21:07:30

I’d like to have the specs available easily as a map, because since it’s autogenerated there’s a pretty good chance that you’ll want to amend the result

lvh21:07:45

e.g. specify a generator, or make a constraint more precise (or both)

gfredericks21:07:45

similar is (defmacro load-specs [] (code to make spec forms)) (load-specs)

lvh21:07:01

yeah that’s basically what I’m doing after

lvh21:07:25

I should probably learn the difference between generating intern and def in a macro

lvh21:07:39

but that’s definitely not ontopic for this channel 🙂

gfredericks21:07:41

if you want to really wash your hands of dynamic runtime monkeydoodling you could generate the code and spit it to a source file that goes into version control

gfredericks21:07:58

so it turns into a dev-time task

lvh21:07:16

that sounds like something a go programmer might do 😉

lvh21:07:27

I’ve already dodged that bullet with caesium (generating an interface)