3 ms·
There is no safe dead code removal. If the code being removed has any effects in it (the encoding of which is possible in a pure language), the fact that it's u
by kazinator 6y ago
There is no safe dead code removal. If the code being removed has any effects in it (the encoding of which is possible in a pure language), the fact that it's unreachable could be a bug. If you sneakily just remove it without telling the user, you're colluding with the bug.
Recently, I discovered an like-new pair of shoes at the bottom of a closet. I bought them some four or five years ago, I guess, and somehow forgot about them. They got buried under other items. This was a day or two before Christmas; it was like an unexpected present.
Now, someone could have surreptitiously entered my home at any time before that and removed these "dead shoes". I would never have known.
So therefore, it wouldn't be stealing, right? It's a "semantics-preserving transformation of someone's belongings".
- setr 6y agoWell, it’s safe in that it’s correct. You could remove it without warning, and the program would behave the same. That does not preclude notifying the user, or getting confirmation
- jfmengels1 6y agoAnd that is exactly the reason why the tool from the article asks you for confirmation at every step. So that you can actually go and say "oh, no, I want to keep and use that". But even if you do blindly accept each fix, the behavior of the program won't change.