3 ms·
One thing I don't like about goto is that it allows the creation of irreducible control flow. Makes all kinds of optimizations and program analysis more difficu
by ufo 5y ago
One thing I don't like about goto is that it allows the creation of irreducible control flow. Makes all kinds of optimizations and program analysis more difficult. When I have the chance, I advocate for more well behaved alternatives such as labeled break statements. Although they're more restrictive, most of the time they're all you need.
- paiute 5y agoyes they can be used for evil but how are exceptions different?
- klyrs 5y agoThis is true, but I suspect that you're getting downvoted because python doesn't do bytecode optimization.
- nerdponx 5y agoCPython doesn't. But the other Python implementations (PyPy, GraalVM, et al) don't even use the CPython bytecode.
- klyrs 5y agoAlso true... but this decorator isn't going to work in that context.
- masklinn 5y agoCpython absolutely does, just not much of it (it has a peephole optimiser with a very small set of opts).
- eru 5y agoProperly implemented tail calls are all you need. You can get loops and goto etc from there. (You might still want extra first class support for eg exceptions.)