News for hackers. Stuff that matters.
Re:A function decorator that rewrites the bytecode to enable... by Dylan16807 on Tuesday September 21, 2021 @06:55AM (#28603754)
Isn't that basically every control flow mechanism?
Re:A function decorator that rewrites the bytecode to enable... by mumblemumble on Tuesday September 21, 2021 @09:54AM (#28605030)
That was even the whole point behind Dijkstra's paper. To paraphrase, "Goto is a very powerful language feature. Which is exactly the problem. Less powerful features give programmers less latitude to do clever things their colleagues (and the compiler) can't reason about effectively."
Re:A function decorator that rewrites the bytecode to enable... by rightbyte on Tuesday September 21, 2021 @07:45AM (#28604052)
Ye sure. I meant that it feels like jumping through hoops to introduce a lot of different mechanisms just to remove goto:s. E.g. "labeled breaks" and using silly loop constructs.
Re:A function decorator that rewrites the bytecode to enable... by AndyKelley on Tuesday September 21, 2021 @03:07PM (#28608606)
You have it precisely backwards.

These features already have reasons to exist, because they solve control flow scenarios. So there they are. And then we are brought the question of introducing goto, and there's just nothing that it adds. It would make the language more complicated for no reason.

Re:A function decorator that rewrites the bytecode to enable... by Dylan16807 on Tuesday September 21, 2021 @07:29PM (#28611325)
They're not set up in the most elegant way, but the concept of leaving a nested loop is very simple and should definitely be possible without a goto. And switching between states in a state machine, where each state has a single entrance like a normal function, should also be simple.

With goto you can't know at a glance if the code is following those patterns or doing some kind of spaghetti nonsense. It hurts readability.