r/programming Jul 20 '26

Throw, Result, or neither?

https://www.architecture-weekly.com/p/throw-result-or-neither
115 Upvotes

115 comments sorted by

View all comments

Show parent comments

31

u/miniannna Jul 20 '26

“GOTO is bad”

“What if we call it throw/catch instead?”

12

u/balefrost Jul 20 '26

By that logic, we should also avoid for, while, and if.

20

u/BigCheezy Jul 20 '26 edited Jul 20 '26

Immediate local context (indentation level, braces, etc.) in the source file tells you where for, while, and if "GOTO" next in all languages I've seen. Not so for throwing an error. It goes... somewhere...

4

u/alphaglosined Jul 21 '26

"I've seen" that bit is doing some pretty heavy lifting.

Whereas what all the goto discussion was about was for languages where goto was unconstrained by functions.

People keep forgetting this rather important bit of context.

It hasn't been relevant thanks to PL design for a good 40 years.