4 ms·
I don't really understand how this is relevant. Sure, memoization is more efficient for recursive fibonacci, but in both cases the code is correct. The author
by horsawlarway 8y ago
I don't really understand how this is relevant.
Sure, memoization is more efficient for recursive fibonacci, but in both cases the code is correct.
The author is presenting a case in which code is made demonstrably incorrect by seemingly unrelated changes, because those changes altered invariants about the objects the author was using - making his assumptions about which actions were safe incorrect.
That's a good time for tooling to throw warnings/errors. Where you seem to be proposing... nothing?