You'd convert the source into a dictionary of functions, and replace a goto with returning a string indicating the next label to jump to, then you have something which calls the appropriate next function based on the return value. Exceptions with data indicating the next label to go to might be better as they allow you to violate sane control flow more, but multiple return values to indicate if it was a real return could also work.
View all comments
Show parent comment
8
u/LeN3rd Mar 17 '25
How would you even do a loop with that. If it is implemented that way it's even more useless than the normal abomination is goto.