3 ms·
So basically treat even invariants as possibly varying.
by mooreds 9y ago
So basically treat even invariants as possibly varying.
- jeremiep 9y agoInvariants are still invariants. You just want some guarantee that they actually hold. Every time you use assert() somewhere you're doing just that.
- friendzis 9y agoNot necessarily. Very often we extract some invariants from data and embed them in code because it makes code much cleaner, easier to write, etc.. The problem is that some things that we assume (sometimes explicitly, sometimes by mistake) to be invariants are not necessarily invariants after all. Very, very unlikely to change, but not invariants nevertheless. I guess rather well-known real world example is systems starting to show weird behaviour when database resultset ordering changes (e.g. changes in indexing) and someone relies on correct entry being first/last. Assumed invariant here is resultset ordering and code is written with this particular invariant in mind. If not enough ordering clauses are used, resultset ordering is not invariant, even though it worked for years already :)