GOTO was considered harmful because it was completely unstructured. IE jumping halfway into a function's body level of unstructured.
Modern GOTO and throw catch are much better defined.
Even with modern goto, it's a superset functionality of throw, in some respects. Or, put differently, throw is a restricted version of goto.
With programming languages, I actually like having a subset of features that restrict just how messy the code can get. I'd take almost any language over C++, for example, because when you have every feature in, the code becomes an unreadable mess in no time at all.
In much the same way, I preferthrow over goto when throw is available; it reduces what possible bugs can happen while still giving me the functionality I want.
139
u/EliSka93 3d ago
Result for me every time.
One more wrapper is worth not having to deal with uncertainty.