2 ms·
>There are so many more invariants [...] that you can't practically check with a static system You can't statically check the invariants directly, but you can
by aninhumer 9y ago
>There are so many more invariants [...] that you can't practically check with a static system
You can't statically check the invariants directly, but you can make types that statically enforce that the invariants are dynamically checked.
That way you can be sure your assumptions hold when the data gets to your code, and any invalid data will be recognised as such, rather than manifesting as weird behaviour.
- jstimpfle 9y agoSo that's managed languages? They exist and have their justifications, but come at a performance hit, and much like static types can practically only check a subset of invariants. Just because there are so many of them. The way I think about it is simply that I write a program with code and the compiler statically enforces that what I specified there holds at runtime. Code is a pretty nice way to express invariants :-)