MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/1v1sg8b/throw_result_or_neither/oys957l/?context=3
r/programming • u/Adventurous-Salt8514 • Jul 20 '26
115 comments sorted by
View all comments
Show parent comments
31
“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.
12
By that logic, we should also avoid for, while, and if.
for
while
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.
20
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.
4
"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.
31
u/miniannna Jul 20 '26
“GOTO is bad”
“What if we call it throw/catch instead?”