3 ms·
It's only obviously more effective coming from a very narrow perspective. Static typing can provide stronger guarantees, but if it takes significantly more effo
by yogthos 8y ago
It's only obviously more effective coming from a very narrow perspective. Static typing can provide stronger guarantees, but if it takes significantly more effort to do that and you already get adequate guarantees with contracts then that effort is likely not justified.
The goal is typically to ship software that works well enough in a reasonable amount of time, and my experience is that contracts provide a much better tool for doing that.
While contracts need to execute the code, generative testing provides you with a sufficient sample to be reasonably sure that the code is doing what you want. The contracts also let you directly specify what the code is intended to be doing, something that's not easy to do using the type system.
In some situations proving parts of the program behavior may be worth the effort, but I simply don't agree that it's true for the general case.