Similarly you can do HTML form validation, etc.
We even use honeysql with nice helper functions that ensure that data-changing SQL queries are of the expected form. Say, you want to update just one row, you have a helper function that checks the honeysql data has a where clause with a unique column and only then runs the query. Someone should maybe blog about that sometime.
What I've found, though, is that trying to use spec like type checking is usually not a great idea. I expect better from static analysis / compile-time checking, with clj-kondo being the most promising tool atm.
The only strange use of spec I mentioned is validating db queries. For us updates and deletes are rare enough that perf doesn't matter.
Would make a nice library name. Wonder if Metosin takes requests...
Personally I'm still a static-types person, but I get it. And if I used Clojure regularly, I'd be all over Spec.
And performance.
- input and message streams validation.
- data generation for testing.
- spec is the best data structures documentation!
- sequential data structures parsing and transform
More magic, but based on everything mentioned: dev-time macro input and destructuring sanitizing and error report.
So I can't figure out if it is more like a debugger for targeted location of difficult bugs or more like compiler error messages where it becomes a pervasive part of the workflow.
There is obviously something to this spec if it warrants a v2. It just isn't obvious whether it solves my problems, library maintainer problems or professional problems. It is very different to the immutable-everywhere design where a Clojure beginner is forced in to understanding it to even try trivial experiments.