5 ms·
Yes, but humans mess up loops far more frequently than compilers do. If we follow your argument recursively, we would all end up writing assembly language again
by rubiquity 12y ago
Yes, but humans mess up loops far more frequently than compilers do. If we follow your argument recursively, we would all end up writing assembly language again, wouldn't we? :)
- coldtea 12y agoIs that meant as an argument against loops and pro recursion? Because humans also screw recursion all the time.
- rubiquity 12y agoI guess. But if I make the mistake of infinitely recursing I find out the next time I run my program. If I'm writing my own loops and make an off by one error it could go uncaught potentially forever.
- pekk 12y agoYou don't necessarily find out the next time you run your program. A stack overflow can go uncaught potentially forever.
- PaulHoule 12y agoOne of my favorite PHP gotchas is to accidentally write a function that calls itself infinitely, and then have the interpreter die without a warning message.
- Rusky 12y agoSo use iterators? Sometimes loops are just the clearer way to express something.
- mtdewcmu 12y agoIf a program is only doing a simple calculation and it's still running an hour later, you should probably suspect an infinite loop and not wait for it to stop.