Spec present and future


I’m wondering about spec…

Everybody agrees that what spec “do” is really usefull (error message maybe excluded)

Fewer people talks about what spec “is” (implementation, use cases, generalisations…)

Have you study spec source?
What do you think about it?

I think it is not so pretty/understandable. (compared to test.check for instance, which is really beautiful)
I understand that this is alpha, so i’m wondering what cognitect planned to do (and when) for the post alpha stage.

Is there any refactoring/rewriting of spec in the wild?

I am also really sorry to bring this on the table, but, is the global registry really a good idea?
One can imagine to write only pure functions with registry as first param, and if you want global state like behavior, just partially apply all functions, and you are done. the implementation would be simpler to understand i think.

and also, what do you think about the clojure.spec.alpha/keys spec?


I have to agree, I wish specs were easier to create, extend, introspec and customize. Something closer to https://github.com/metosin/spec-tools would be nice.

As for the global registry, they’ve talked about possibly adding custom registry in the future, but with the forced namespacing, the global registry should be fine most of the time. It does have the advantage of ease of use.

The keys spec I find useful, for the most common use case of defining <keyword, object> maps. I wish it could support keys that are non keywords also, and that it validated spec existence.

From me using spec, my bigger issues has been around extension of specs, and the fact that it uses keywords as a pointer.

The most common source of frustration is when someone mistypes the key, or forget to alias the namespace. I really wish there was more safety around that.

1 Like

Yes, metosin’s spec-tools is nice. But Cognitect also have something in store regarding that:
“The next version will increase programmability” https://youtu.be/2V1FtfBDsLU?t=4208

I’m not sure what you mean by “extension of specs”.


1 Like

It takes a little getting used to, but once you do it’s not that bad. I use specs in a pet project to (de)serialize data in an avro like way, so only storing the values, which was not that hard. I wonder what the new spec will look like.
I do have to admit that for my latest per project I haven’t used spec at al. But Lacinia did use it, and it probably saved me a lot of time debugging.
I think in general spec is a lot more useful in libraries, then directly in projects.