News for hackers. Stuff that matters.
Re:What can be learned from studying long gone development p... by lmm on Monday August 16, 2021 @03:52AM (#28195886)
State machines and actors are occasionally cited as good ideas here, and they seem like much the same kind of unstructured programming IME.
Re:What can be learned from studying long gone development p... by zozbot234 on Monday August 16, 2021 @05:20AM (#28196298)
Indeed, GO TO is not that unstructured; it can be said to have a fairly precise semantics of "sets the continuation of the program to <label>; does not proceed to the next statement.". Though if you want to analyze the semantics of a GO TO-using program, it's practically a required step to endow all of your labels with appropriate COME FROM annotations, marking the branches it could be reached from - and that's a whole-program analysis, at least in principle. That's the point where you're giving up modularity!
Re:What can be learned from studying long gone development p... by m_mueller on Monday August 16, 2021 @04:23AM (#28196027)
Why? You can easily emulate a state machine with a while loop, a switch case and one more level of if-branches. Abstracting those in a framework doesn't make it unstructured IMO.
Re:What can be learned from studying long gone development p... by lmm on Monday August 16, 2021 @04:36AM (#28196082)
> You can easily emulate a state machine with a while loop, a switch case and one more level of if-branches.

You can easily emulate GOTO much the same way.

Re:What can be learned from studying long gone development p... by m_mueller on Monday August 16, 2021 @05:15AM (#28196268)
obviously, as long as the language is turing complete, but you just converted an unstructured program to a structured one.
Re:What can be learned from studying long gone development p... by lmm on Monday August 16, 2021 @08:32AM (#28197287)
To the same extent, and in the same way, as you did when you converted a state machine the same way? I still don't get what distinction you're drawing between state machine style and GOTO style.
Re:What can be learned from studying long gone development p... by maskros on Monday August 16, 2021 @08:09AM (#28197125)
And gained nothing except more verbose syntax. The goto spaghetti is still spaghetti whether you use "goto" or "switch".
Re:What can be learned from studying long gone development p... by m_mueller on Monday August 16, 2021 @03:00PM (#28201568)
Disagree. You eliminate backward gotos except for the while loop, which is much more clearly communicating the way to extend the code (by adding more states or state transitions) to the next person taking over. I‘m not categorically against goto in certain contexts (like C based systems programming), but IMO backwards jumps with goto need to be eliminated.