3 ms·
I have a general opinion about this sort of thing: no programming pattern is always bad or always good. Even gotos are not always harmful. The important thing
by JohnFen 3y ago
I have a general opinion about this sort of thing: no programming pattern is always bad or always good. Even gotos are not always harmful.
The important thing is clarity of code. If arrow code makes that part of the code easier to understand and less likely to lead a future dev (who may be you!) to make a mistake, then it's a good thing.
If setting flags makes that code easier to understand and less likely to lead a future dev to make a mistake, then that's a good thing.
It all depends on the project, and has to be balanced with a consistent approach also being a good thing. If flags are used everywhere else, then use them even if arrow code would be more clear for a given section, and vice versa. This is the purpose for "house rules" about coding style, and such house rules are usually the best way to go.
My TL;DR is: anytime someone says that "X is always good" or "X is always bad", that person is wrong. X may usually be good or bad, but there are always exceptions.
- Jigsy 3y agoYeah, goto gets a bad wrap imo. I mean, sure, nobody should be using it for loops, but if you're jumping right to the end of a function (or a while loop) and doing cleanup operations, is that such a bad thing?