3 ms·
It needs to be said, "elseif" statement should not exist at all. I have fixed a lot of bugs due to "elseif" over the decades in various languages. The person
by jmclnx 2y ago
It needs to be said, "elseif" statement should not exist at all.
I have fixed a lot of bugs due to "elseif" over the decades in various languages. The person who came up with that construct should endure the Confy Chair.
https://www.youtube.com/watch?v=T2ncJ6ciGyM https://www.youtube.com/watch?v=T2ncJ6ciGyM
- bayindirh 2y agoelse-if has useful properties, which allows designing flows with simpler condition statements and allows processor to jump less and lose less time (low-power systems are still and will be a thing). If we didn't have else-if, somebody will certainly lament "If we had something called else-if, I'd not have fixed a lot of bugs due this complex condition statements in various languages. The person who opposes implementation of such a simple construct should endure the Confy Chair". So, it goes both ways.
- orwin 2y agoI'm not a branchless coding fanatic at all, but arguing for else-if with execution speed arguments isn't the way. Moreover, else-if is probably the most misused conditional, so while I disagree that it shouldn't exist (it has some uses), GP has a point. Although linters now are good enough now to catch poorly used conditionals, so his point is way less relevant than it was a decade ago.
- bayindirh 2y ago> but arguing for else-if with execution speed arguments isn't the way. Depends on the code base and problem domain you code / live in. In most cases you're right, but in my domain it's a different story. > Moreover, else-if is probably the most misused conditional You can misuse anything in any language, so by this logic we should argue that we shall abolish all programming altogether. I can misuse threads to make a program slower, misuse memory allocator to fragment the memory, etc. etc. So I don't think "but people misuse it" is a great argument either.
- al2o3cr 2y agoNonsense. This is like arguing that because you've seen plumbing that was installed badly with wrenches, that wrenches shouldn't exist.
- deleted 2y ago[deleted]