3 ms·
What are the callers supposed to do when the assertion fails? Either you carry the assertion all the way back to the point where x is created - in which case yo
by lmm 4y ago
What are the callers supposed to do when the assertion fails? Either you carry the assertion all the way back to the point where x is created - in which case you're implementing a type system, whether you call it that or not - or you have code that will have runtime failures in the middle of your computations.
- galaxyLogic 4y ago> you have code that will have runtime failures in the middle of your computations. Preferably during running of your unit-tests. In practice much of the software we use today has runtime errors. How the code handles those varies. Static typing does not prevent runtime errors does it?
- lmm 4y ago> Preferably during running of your unit-tests. Which means you need more unit test coverage, have more tests to maintain, and your code structure becomes more brittle. > Static typing does not prevent runtime errors does it? Often it does; and if a validation rule is too complex or externally-dependent to enforce at compile time, static typing at least lets you push checking to the start of an operation, rather than in the middle of your computation.