3 ms·
The problem is that in order to delete an unused variable, you may need to delete a huge chunk of code which would be useful later when you want to actually use
by xigoi 2y ago
The problem is that in order to delete an unused variable, you may need to delete a huge chunk of code which would be useful later when you want to actually use the variable.
- em-bee 2y agocan you give an example please? i can't imagine how any section of code would be affected by removing an unused variable. if the code reference the variable, it would be used. if it doesn't, then why would you have to delete it?
- xigoi 2y agoIn pseudocode: a = input() b = f(a) c = g(b) d = h(c) If you delete the unused variable d, then c will be unused, so you’ll have to delete it too. Iterating this, you will end up deleting the entire code.
- throwawaymaths 2y agoYou could: - comment it out - use git - use ctrl-z
- xigoi 2y agoHaving to do that after every small change really breaks the flow.
- throwawaymaths 2y agoYeah ok. Overstated. in reality this will be at most 1/20th if your changes. Maybe 1/6 if you're debugging.
- alpaca128 2y agoOr alternatively the compiler could just not force me to do any of those things.