News for hackers. Stuff that matters.
Re:A function decorator that rewrites the bytecode to enable... by ufo on Monday September 20, 2021 @09:23PM (#28601072)
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.
Re:A function decorator that rewrites the bytecode to enable... by klyrs on Monday September 20, 2021 @09:55PM (#28601253)
This is true, but I suspect that you're getting downvoted because python doesn't do bytecode optimization.
Re:A function decorator that rewrites the bytecode to enable... by nerdponx on Monday September 20, 2021 @11:21PM (#28601774)
CPython doesn't. But the other Python implementations (PyPy, GraalVM, et al) don't even use the CPython bytecode.
Re:A function decorator that rewrites the bytecode to enable... by klyrs on Tuesday September 21, 2021 @12:16PM (#28606578)
Also true... but this decorator isn't going to work in that context.
Re:A function decorator that rewrites the bytecode to enable... by masklinn on Tuesday September 21, 2021 @05:37AM (#28603383)
Cpython absolutely does, just not much of it (it has a peephole optimiser with a very small set of opts).
Re:A function decorator that rewrites the bytecode to enable... by eru on Tuesday September 21, 2021 @02:46AM (#28602588)
Properly 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.)

Re:A function decorator that rewrites the bytecode to enable... by paiute on Monday September 20, 2021 @11:00PM (#28601654)
yes they can be used for evil but how are exceptions different?