3 ms·
I'm not saying types always model your problem properly! That's not even well specified. I'm saying that "x has type foo" is never wrong if the program typechec
by c-cube 5y ago
I'm not saying types always model your problem properly! That's not even well specified. I'm saying that "x has type foo" is never wrong if the program typechecks properly. That's totally different, and it means that you can rely on type annotations as being correct, up-to-date documentation. You can also trust that functions are never applied to the wrong number of arguments, or the wrong types; my point is that this guarantees more, in a less expressive way, than specs.
- travisjungroth 5y agoYou can statically analyze specs and check them at runtime if you want.
- c-cube 5y agoCan you? Is there any tool that actually does that reliably?
- travisjungroth 5y agohttps://clojure.org/guides/spec#_using_spec_for_validation https://clojure.org/guides/spec#_using_spec_for_validation
- c-cube 5y agoThe words "static" or "analysis" do not appear there. I imagine you meant that you can runtime check the specs, which, well, is no replacement for a type system.