3 ms·
What are you talking about? I don't understand how you've never encountered variables depending on each other. In any moderately complex function you'll have m
by spoiler 4y ago
What are you talking about? I don't understand how you've never encountered variables depending on each other.
In any moderately complex function you'll have more than one expression, and those can depend on each other. And you want them to be named and assigned; it makes it easier to read and decode intent and debug things (unless you're one of those wizards who get it right on the first try every time, kudos to you then). I'd not approve a PR that inlines/embeds complex concepts within larger expressions just to avoid creating variables...
Edit: typos
- vanderZwan 4y agoOf course I have encountered dependent variables, but if I have a long chain of unused variables that means that either that code is ready to go, or the code organization needs refactoring.
- hhmc 4y agoYou seem to be missing the whole point being made — they are unused because of (temporary) changes during prototyping.
- vanderZwan 4y agoAh yes, prototyping. The stage of coding where one has lots of snippets of code meant for trying things out quickly. Definitely a context full of long chains of dependent variables.
- hhmc 4y agoOne might imagine prototyping new functionality in a existing, complex, codebase..
- afiori 4y agoAt first you have a long chain of used variables that end up into a value used somewhere. If then you refactor away that single final value you need to delete all the previously used variables that now need to be "deallocated" by you.
- simion314 4y agoDude, it is about debugging, or work in progress... Did you ever tried to debug some issue and start commenting stuff to try and find the problematic area? Hell when I comment stuff soemtimes private function will get unused , so with a shit compiler you would need to also comment the private functions, remove unused classes etc. In my code I assure the linter will say 0 warnings.